MPIOfflineSearchManager
public class MPIOfflineSearchManager
Offline Search Manager
-
Get search suggestions based on a query
Sample usage for getting suggestions when the user types in “C”
mapView?.OfflineSearch.suggest(query: "C") { results in results?.hits.forEach { result in print("Got suggestion: " + result.text) } }
Declaration
Swift
public func suggest(query: String, callback: @escaping (MappedinOfflineSearchSuggestions?) -> Void)
Parameters
query
Term to find suggestions for
callback
Callback with suggestions
Return Value
Void
-
Search for
Sample usage searching with the query “Foot Locker” and printing the returned object names
mapView?.OfflineSearch.search(query: "Foot Locker") { results in results.forEach { result in switch result { case let result as MappedinOfflineSearchResultLocation: print("Got location: " + result.object.name) case let result as MappedinOfflineSearchResultCategory: print("Got category: " + result.object.name) default: print("Got custom (should not happen yet)") } } }
Declaration
Swift
public func search( query: String, callback: @escaping ([MappedinOfflineSearchResultCommon]) -> Void )
Parameters
query
Term to search for
callback
Callback when search results are returned
Return Value
Void