Created
May 7, 2021 19:39
-
-
Save mathonsunday/dbbd186423c20b8f13ada866620d9bd2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
func suggest(query: String, currentLocation: Location? = nil) { | |
lastQuery = query | |
currentRequest?.cancel() | |
currentRequest = nil | |
let request = SearchSuggestRequestV2() | |
request.q = query | |
request.limit = 10 | |
request.listingTypes = [.sales] | |
request.rankerVersion = "v4.0" | |
request.limitToGeos = [] | |
request.includeAgentSearchableSuggestions = false | |
request.sources = [.address, .neighborhood] | |
request.categorizingStrategy = .classic | |
request.displayMode = .classic | |
currentRequest = omniSuggestService.omniSuggestAutoComplete(request: request, onNext: { [weak self] response, _ in | |
guard let self = self, query == self.lastQuery else { | |
return | |
} | |
self.suggestion = response | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment