Come posso ottenere un array con tutti i nomi dei Paesi in Swift? Ho cercato di convertire il codice che avevo in Objective-C, che è stato questo:Swift - Ottieni l'elenco dei Paesi
if (!pickerCountriesIsShown) {
NSMutableArray *countries = [NSMutableArray arrayWithCapacity: [[NSLocale ISOCountryCodes] count]];
for (NSString *countryCode in [NSLocale ISOCountryCodes])
{
NSString *identifier = [NSLocale localeIdentifierFromComponents: [NSDictionary dictionaryWithObject: countryCode forKey: NSLocaleCountryCode]];
NSString *country = [[NSLocale currentLocale] displayNameForKey: NSLocaleIdentifier value: identifier];
[countries addObject: country];
}
E a Swift non riesco a passare da qui:
if (!countriesPickerShown) {
var countries: NSMutableArray = NSMutableArray()
countries = NSMutableArray.arrayWithCapacity((NSLocale.ISOCountryCodes).count) // Here gives the Error. It marks NSLocale.ISOCountryCodes and .count
Qualcuno di voi sa a questo proposito?
Grazie
sto ottenendo zero elementi in serie! – Kirti