Skip to Content
0
Aug 02, 2017 at 02:25 PM

Search/Filter EntitySet without Navigation Property

90 Views

Hi,

i have a list of Customers at the Master view and want to filter them via search bar.

i implemented the search function as described at https://www.sap.com/developer/tutorials/fiori-ios-scpms-floorplan.html

but i don´t know how to filter my collection due to the fact that xcode is telling me that the collection does not have the function "filter"

self.appDelegate.colletions is defined like that:

var collections = CollectionType.allValues.map({ (collectionType) -> String in
    return collectionType.rawValue
    })
func updateSearchResults(for searchController: UISearchController) {

        guard let searchString = searchController.searchBar.text, !searchString.isEmpty else {
            self.isFiltered = false
            self.filteredCustomers.removeAll()
            self.tableView.reloadData()
            return
        }
        self.isFiltered = true
        self.filteredCustomers = self.appDelegate.collections[0].filter( {
            return
                $0.name1!.contains("LINDNER")
        })
        self.tableView.reloadData()
    }