Skip to content
This repository has been archived by the owner on Apr 8, 2023. It is now read-only.

Commit

Permalink
Merge pull request #14 from v-ken/quicksearch
Browse files Browse the repository at this point in the history
Ensure that the search results matches the current search term
  • Loading branch information
Jerome Tan committed Sep 14, 2016
2 parents 306b305 + 0f892d5 commit e1d6ff2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions LocationPicker/LocationPicker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,10 @@ extension LocationPicker: UISearchBarDelegate {
localSearchRequest.region = MKCoordinateRegionMakeWithDistance(defaultSearchCoordinate, searchDistance, searchDistance)
}
MKLocalSearch(request: localSearchRequest).startWithCompletionHandler({ (localSearchResponse, error) -> Void in
guard searchText == searchBar.text else {
// Ensure that the result is valid for the most recent searched text
return
}
guard error == nil,
let localSearchResponse = localSearchResponse where localSearchResponse.mapItems.count > 0 else {
if self.allowArbitraryLocation {
Expand Down

0 comments on commit e1d6ff2

Please sign in to comment.