mirror of
https://github.com/zhigang1992/GitHawk.git
synced 2026-06-15 01:59:07 +08:00
45 lines
1.4 KiB
Swift
45 lines
1.4 KiB
Swift
//
|
|
// IssueManagingNavSectionController.swift
|
|
// Freetime
|
|
//
|
|
// Created by Ryan Nystrom on 1/1/18.
|
|
// Copyright © 2018 Ryan Nystrom. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
import IGListKit
|
|
|
|
protocol IssueManagingNavSectionControllerDelegate: class {
|
|
func didSelect(managingNavController: IssueManagingNavSectionController)
|
|
}
|
|
|
|
final class IssueManagingNavSectionController: ListSectionController {
|
|
|
|
private weak var delegate: IssueManagingNavSectionControllerDelegate?
|
|
|
|
init(delegate: IssueManagingNavSectionControllerDelegate) {
|
|
self.delegate = delegate
|
|
}
|
|
|
|
override func sizeForItem(at index: Int) -> CGSize {
|
|
guard let containerWidth = collectionContext?.insetContainerSize.width
|
|
else { fatalError("Collection context must be set") }
|
|
return CGSize(
|
|
width: floor(containerWidth / 2),
|
|
height: Styles.Sizes.labelEventHeight
|
|
)
|
|
}
|
|
|
|
override func cellForItem(at index: Int) -> UICollectionViewCell {
|
|
guard let cell = collectionContext?.dequeueReusableCell(of: IssueManagingExpansionCell.self, for: self, at: index) as? IssueManagingExpansionCell
|
|
else { fatalError("Cannot dequeue cell") }
|
|
return cell
|
|
}
|
|
|
|
override func didSelectItem(at index: Int) {
|
|
collectionContext?.deselectItem(at: index, sectionController: self, animated: true)
|
|
delegate?.didSelect(managingNavController: self)
|
|
}
|
|
|
|
}
|