IGListKit/Examples/Examples-iOS/IGListKitExamples/SectionControllers/LabelSectionController.swift

31 lines
802 B
Swift
Raw Normal View History

/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import IGListKit
import IGListSwiftKit
import UIKit
final class LabelSectionController: ListSectionController {
private var object: String?
override func sizeForItem(at index: Int) -> CGSize {
return CGSize(width: collectionContext!.containerSize.width, height: 55)
}
override func cellForItem(at index: Int) -> UICollectionViewCell {
let cell: LabelCell = collectionContext.dequeueReusableCell(for: self, at: index)
cell.text = object
return cell
}
override func didUpdate(to object: Any) {
self.object = String(describing: object)
}
}