Код: Выделить всё
public func resolveCountry(for intent: VASValidationIntent, with completion: @escaping (VASValidationCountryResolutionResult) -> Void) {
// Check if the country is not yet resolved (i.e., ambiguous)
guard let country = intent.country else {
// Map the country names to the custom 'Country' object or INObject if it's predefined
let countryObjects = availableCountriesTen.map { name -> Country in
let country = Country(identifier: name, display: name)
return country
}
// Use the disambiguation response, passing the list of countries for Siri to choose from
completion(.disambiguation(with: countryObjects))
return
}
completion(.success(with: country))
}
Подробнее здесь: https://stackoverflow.com/questions/794 ... -countries
Мобильная версия