Iphone, Obtaining a List of countries in an NSArray

后端 未结 6 1858
暗喜
暗喜 2020-12-04 09:04

I have a menu that let\'s a user select a country. Exactly like that in the contacts.app country menu within the address field.

Does anyone know a simple way of get

6条回答
  •  天涯浪人
    2020-12-04 09:26

    Swift 3

    let locale = Locale.current
    let countries = Locale.isoRegionCodes.map {
        locale.localizedString(forRegionCode: $0)!
    }.sorted()
    

提交回复
热议问题