mirror of
https://github.com/Instagram/IGListKit
synced 2026-05-10 02:50:53 +00:00
47 lines
1.7 KiB
Swift
47 lines
1.7 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 StoryboardViewController: UIViewController, IGListAdapterDataSource {
|
||
|
|
|
||
|
|
@IBOutlet weak var collectionView: IGListCollectionView!
|
||
|
|
|
||
|
|
lazy var adapter: IGListAdapter = {
|
||
|
|
return IGListAdapter(updater: IGListAdapterUpdater(), viewController: self, workingRangeSize: 0)
|
||
|
|
}()
|
||
|
|
|
||
|
|
lazy var words = "Maecenas faucibus mollis interdum Praesent commodo cursus magna, vel scelerisque nisl consectetur et".components(separatedBy: " ")
|
||
|
|
|
||
|
|
override func viewDidLoad() {
|
||
|
|
super.viewDidLoad()
|
||
|
|
adapter.collectionView = collectionView
|
||
|
|
adapter.dataSource = self
|
||
|
|
}
|
||
|
|
|
||
|
|
//MARK: IGListAdapterDataSource
|
||
|
|
|
||
|
|
func objects(for listAdapter: IGListAdapter) -> [IGListDiffable] {
|
||
|
|
let items: [IGListDiffable] = words as [IGListDiffable]
|
||
|
|
return items
|
||
|
|
}
|
||
|
|
|
||
|
|
func listAdapter(_ listAdapter: IGListAdapter, sectionControllerFor object: Any) -> IGListSectionController {
|
||
|
|
return StoryboardLabelSectionController()
|
||
|
|
}
|
||
|
|
|
||
|
|
func emptyView(for listAdapter: IGListAdapter) -> UIView? { return nil }
|
||
|
|
}
|