Could you please help on how to get country code using NSLocale
in Swift 3
?
This is the previous code I have been using.
NSLocale.currentLocale().objectForKey(NSLocaleCountryCode) as! String
I can get Language Code as below in Swift 3.
Locale.current.languageCode!
As I can see, fetching languageCode is straight forward but countryCode property is not available.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…