Files
GitHawk/Classes/Issues/ReferencedCommit/IssueReferencedCommitSectionController.swift
2018-05-30 22:28:32 -04:00

34 lines
1.1 KiB
Swift

//
// IssueReferencedSectionController.swift
// Freetime
//
// Created by Ryan Nystrom on 7/9/17.
// Copyright © 2017 Ryan Nystrom. All rights reserved.
//
import Foundation
import IGListKit
final class IssueReferencedCommitSectionController: ListGenericSectionController<IssueReferencedCommitModel> {
override func sizeForItem(at index: Int) -> CGSize {
guard let width = collectionContext?.insetContainerSize.width,
let object = self.object
else { fatalError("Missing context") }
return CGSize(
width: width,
height: object.string.viewSize(in: width).height
)
}
override func cellForItem(at index: Int) -> UICollectionViewCell {
guard let cell = collectionContext?.dequeueReusableCell(of: IssueReferencedCommitCell.self, for: self, at: index) as? IssueReferencedCommitCell,
let object = self.object
else { fatalError("Missing context, model, or cell wrong type") }
cell.configure(object)
cell.delegate = viewController
return cell
}
}