2016-11-12 17:18:29 +00:00
|
|
|
/**
|
|
|
|
|
Copyright (c) 2016-present, Facebook, Inc. All rights reserved.
|
|
|
|
|
|
|
|
|
|
The examples provided by Facebook are for non-commercial testing and evaluation
|
|
|
|
|
purposes only. Facebook reserves all rights not expressly granted.
|
|
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
|
FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
|
|
|
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
|
|
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import UIKit
|
|
|
|
|
import IGListKit
|
|
|
|
|
|
2017-04-19 15:17:56 +00:00
|
|
|
final class DisplaySectionController: IGListSectionController, IGListDisplayDelegate {
|
2016-11-12 17:18:29 +00:00
|
|
|
|
|
|
|
|
override init() {
|
|
|
|
|
super.init()
|
|
|
|
|
displayDelegate = self
|
|
|
|
|
inset = UIEdgeInsets(top: 0, left: 0, bottom: 30, right: 0)
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-19 15:17:56 +00:00
|
|
|
override func numberOfItems() -> Int {
|
2016-11-12 17:18:29 +00:00
|
|
|
return 4
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-19 15:17:56 +00:00
|
|
|
override func sizeForItem(at index: Int) -> CGSize {
|
2016-11-12 17:18:29 +00:00
|
|
|
return CGSize(width: collectionContext!.containerSize.width, height: 55)
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-19 15:17:56 +00:00
|
|
|
override func cellForItem(at index: Int) -> UICollectionViewCell {
|
2016-11-12 17:18:29 +00:00
|
|
|
let cell = collectionContext!.dequeueReusableCell(of: LabelCell.self, for: self, at: index) as! LabelCell
|
2017-05-01 14:10:52 +00:00
|
|
|
cell.text = "Section \(self.sectionIndex), cell \(index)"
|
2016-11-12 17:18:29 +00:00
|
|
|
return cell
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// MARK: IGListDisplayDelegate
|
|
|
|
|
|
|
|
|
|
func listAdapter(_ listAdapter: IGListAdapter, willDisplay sectionController: IGListSectionController) {
|
2017-05-01 14:10:52 +00:00
|
|
|
print("Will display section \(self.sectionIndex)")
|
2016-11-12 17:18:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func listAdapter(_ listAdapter: IGListAdapter, willDisplay sectionController: IGListSectionController, cell: UICollectionViewCell, at index: Int) {
|
2017-05-01 14:10:52 +00:00
|
|
|
print("Did will display cell \(index) in section \(self.sectionIndex)")
|
2016-11-12 17:18:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func listAdapter(_ listAdapter: IGListAdapter, didEndDisplaying sectionController: IGListSectionController) {
|
2017-05-01 14:10:52 +00:00
|
|
|
print("Did end displaying section \(self.sectionIndex)")
|
2016-11-12 17:18:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func listAdapter(_ listAdapter: IGListAdapter, didEndDisplaying sectionController: IGListSectionController, cell: UICollectionViewCell, at index: Int) {
|
2017-05-01 14:10:52 +00:00
|
|
|
print("Did end displaying cell \(index) in section \(self.sectionIndex)")
|
2016-11-12 17:18:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|