mirror of
https://github.com/Instagram/IGListKit
synced 2026-04-29 09:27:17 +00:00
Summary: - Fixes #105 - ~~Added a 'SpinnerSectionController' allowing us to trigger the activity spinner each time~~ - Changed the words array to be numbers instead (I found it personally difficult to realise if more cells were actually added as the text didn't seem to change, by using numbers you can quite clearly see it increment by 5 each time you load more) - No changes/new tests as it is a fix to an example - [x] All tests pass. Demo project builds and runs. - [x] I added tests, an experiment, or detailed why my change isn't tested. - [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/CONTRIBUTING.md) Closes https://github.com/Instagram/IGListKit/pull/109 Differential Revision: D4066700 Pulled By: rnystrom fbshipit-source-id: 7779a8ba39361cfa2e782db9460e693e90f1a478
42 lines
1.3 KiB
Swift
42 lines
1.3 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 LabelSectionController: 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!.dequeueReusableCell(of: LabelCell.self, for: self, at: index) as! LabelCell
|
|
cell.label.text = object
|
|
return cell
|
|
}
|
|
|
|
func didUpdate(to object: Any) {
|
|
self.object = String(describing: object)
|
|
}
|
|
|
|
func didSelectItem(at index: Int) {}
|
|
|
|
}
|