Find current country from iPhone device

Viewed 53279

I have to get the current country in the iPhone settings. Can anyone tell me how to get the current country in iPhone application.

I have to use the current country for parsing the RSS feed in which I need to pass the current country.

Please help me out to find the country .

Thanks in advance.

9 Answers

For Swift 4.0,

You can simply use

let countryCode = Locale.current.regionCode

print(countryCode)

Swift 3.0 solution

if let countryCode = (Locale.current as NSLocale).object(forKey: .countryCode) as? String {
            print(countryCode)
        }
Related