简体   繁体   中英

iOS MapKit -search location type

Do you have any idea how to get that string "Country - Asia" under "Thailand" from a search result in MapKit?

I've looked into MKLocalSearchCompleter and all the related classes. But I didn't find anything.

在此处输入图像描述

MKLocalSearchCompleter has a property named results , which is an array of MKLocalSearchCompletion. This type has a property named subtitle, which is what you may be looking for.

You can try something like this:

let completer: MKLocationSearchCompleter = yourCompleter
let subtitle: String = completer.results.first?.subtitle

More on this subject: https://developer.apple.com/documentation/mapkit/mklocalsearchcompletion

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM