mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-01-09 22:31:14 +00:00
* Search example with IGListKit * Cleanup * updated to use new class methods [ASIGListSectionControllerMethods]
45 lines
1.1 KiB
Swift
45 lines
1.1 KiB
Swift
//
|
|
// LabelSectionController.swift
|
|
// RepoSearcher
|
|
//
|
|
// Created by Marvin Nazari on 2017-02-18.
|
|
// Copyright © 2017 Marvin Nazari. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import AsyncDisplayKit
|
|
import IGListKit
|
|
|
|
final class LabelSectionController: IGListSectionController, IGListSectionType, ASSectionController {
|
|
var object: String?
|
|
|
|
func nodeBlockForItem(at index: Int) -> ASCellNodeBlock {
|
|
let text = object ?? ""
|
|
return {
|
|
let node = ASTextCellNode()
|
|
node.text = text
|
|
return node
|
|
}
|
|
}
|
|
|
|
func numberOfItems() -> Int {
|
|
return 1
|
|
}
|
|
|
|
func didUpdate(to object: Any) {
|
|
self.object = String(describing: object)
|
|
}
|
|
|
|
func didSelectItem(at index: Int) {}
|
|
|
|
//ASDK Replacement
|
|
func sizeForItem(at index: Int) -> CGSize {
|
|
return ASIGListSectionControllerMethods.sizeForItem(at: index)
|
|
}
|
|
|
|
func cellForItem(at index: Int) -> UICollectionViewCell {
|
|
return ASIGListSectionControllerMethods.cellForItem(at: index, sectionController: self)
|
|
}
|
|
}
|
|
|