Update the Swift code syntax for reflecting the current APIs for Swift.

Summary:
In this PR, we updated the Swift code syntax for reflecting the current APIs for Swift.

- [x] All tests pass. Demo project builds and runs.
- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/CONTRIBUTING.md)
Closes https://github.com/Instagram/IGListKit/pull/116

Differential Revision: D4089084

Pulled By: rnystrom

fbshipit-source-id: 9c90c2f6d5c52d202086a05efc3fe3b07da41ce3
This commit is contained in:
Jake Lin 2016-10-27 09:57:41 -07:00 committed by Facebook Github Bot
parent e3ea1903f7
commit d1003df845

View file

@ -87,13 +87,12 @@ adapter.collectionView = collectionView
The last step is the `IGListAdapter`'s data source and returning some data.
```swift
func objectsForListAdapter(listAdapter: IGListAdapter) -> [IGListDiffable] {
func objects(for listAdapter: IGListAdapter) -> [IGListDiffable] {
// this can be anything!
return [ "Foo", "Bar", 42, "Biz" ]
}
func listAdapter(listAdapter: IGListAdapter,
sectionControllerFor object: Any) -> IGListSectionController {
func listAdapter(_ listAdapter: IGListAdapter, sectionControllerFor object: Any) -> IGListSectionController {
if object is String {
return LabelSectionController()
} else {
@ -101,7 +100,7 @@ func listAdapter(listAdapter: IGListAdapter,
}
}
func emptyViewForListAdapter(listAdapter: IGListAdapter) -> UIView? {
func emptyView(for listAdapter: IGListAdapter) -> UIView? {
return nil
}
```