Created
August 8, 2017 18:52
-
-
Save CollectiveHealth-gists/0d43eb442ed980d19d9243072e8312ff to your computer and use it in GitHub Desktop.
MKLocalSearchCompleter Initialize
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Initialize MKLocalSearchCompleter | |
let requestCompleter = MKLocalSearchCompleter() | |
// OnDidCompleteRequestProxy | |
requestCompleter.rx_completerDidUpdateResults | |
.flatMap(filterSearchLocation) // filter search locations | |
.subscribe(onNext: { [weak self] (results) in | |
// Method to handle search completer success | |
self?.updateLocations(results) | |
}, onError: { [weak self] error in | |
// Method to handle search completer error | |
self?.handleError(error) | |
}).addDisposableTo(disposeBag) | |
// Set request completer query fragment | |
requestCompleter.queryFragment = queryFragment |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment