Apple introduced the MKLocalSearchCompleter and MKLocalSearchCompletion in iOS 9.3. I am trying to implement it. It becomes a two step process 1) enter partial term -> full search text is generated. 2) User selects one of these to search for the actual location.
The question is if I search for 200 townsend, it gives me a list of locations but it is till treated as suggestion by the app. How can we identify if it is a MKMampItem or suggestion?
One way to do this is to initialize a
MKLocalSearchRequest
with aMKLocalSearchCompletion
.You can then initialize a
MKLocalSearch
with aMKLocalSearchRequest
.You can then start the
search
which has a completion handler with aMKLocalSearchResponse?
andNSError?
. TheMKLocalSearchResponse?
will have an array ofMKMapItem
's.Full example: