IGListKit/Example/IGListKitExamples/SectionControllers/StoryboardLabelSectionController.swift
Bofei Zhu 8855b5156a Add storyboard support #39
Summary:
This PR is for #39

- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/CONTRIBUTING.md)
Closes https://github.com/Instagram/IGListKit/pull/92

Differential Revision: D4066721

Pulled By: rnystrom

fbshipit-source-id: 4fca278ae9a54aa46626932d47d4a4c001b437d6
2016-10-25 15:29:13 -07:00

42 lines
1.4 KiB
Swift

/**
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
class StoryboardLabelSectionController: IGListSectionController, IGListSectionType {
var object: String?
func numberOfItems() -> Int {
return 1
}
func sizeForItem(at index: Int) -> CGSize {
return CGSize(width: collectionContext!.containerSize.width, height: 55)
}
func cellForItem(at index: Int) -> UICollectionViewCell {
let cell = collectionContext!.dequeueReusableCellFromStoryboard(withIdentifier: "cell", for: self, at: index) as! StoryboardCell
cell.textLabel.text = object
return cell
}
func didUpdate(to object: Any) {
self.object = object as? String
}
func didSelectItem(at index: Int) {}
}