Makes objects function more swifty.

Summary:
- [x ] All tests pass. Demo project builds and runs.
- [ ] 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/70

Reviewed By: nlutsenko

Differential Revision: D4025610

Pulled By: rnystrom

fbshipit-source-id: 927e93cec5719466dc152f82a235d5a70e53109d
This commit is contained in:
Valeriy Van
2016-10-14 17:36:10 -07:00
committed by Facebook Github Bot
parent d3442ec497
commit 221c2fbd20
2 changed files with 4 additions and 12 deletions

View File

@@ -48,13 +48,8 @@ class SearchViewController: UIViewController, IGListAdapterDataSource, SearchSec
//MARK: IGListAdapterDataSource
func objects(for listAdapter: IGListAdapter) -> [IGListDiffable] {
var items: [IGListDiffable] = [searchToken]
for word in words {
if filterString == "" || word.lowercased().contains(filterString.lowercased()) {
items.append(word as IGListDiffable)
}
}
return items
guard filterString != "" else { return [searchToken] + words.map { $0 as IGListDiffable } }
return [searchToken] + words.filter { $0.lowercased().contains(filterString.lowercased()) }.map { $0 as IGListDiffable }
}
func listAdapter(_ listAdapter: IGListAdapter, sectionControllerFor object: Any) -> IGListSectionController {