Files
GitHawk/Classes/Issues/Managing/IssueManagingNavSectionController.swift
Ryan Nystrom 65959c7c14 Card inset design completely overhauled (#1396)
* card inset design completely overhauled

* respond to safe area changes
2018-01-13 12:37:00 -05:00

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)
}
}