mirror of
https://github.com/tappollo/IGListKit.git
synced 2026-06-11 15:43:31 +08:00
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:
committed by
Facebook Github Bot
parent
d3442ec497
commit
221c2fbd20
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user