Skip to content

Commit

Permalink
[#96] Fixing incorrect country code fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
marmelroy committed Dec 16, 2016
1 parent cca6a9d commit 915dc26
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions PhoneNumberKit/PhoneNumberKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,8 @@ public class PhoneNumberKit: NSObject {
}
#endif
let currentLocale = Locale.current
if #available(iOS 10.0, *) {
let countryCode = currentLocale.regionCode
return countryCode?.uppercased() ?? ""
if #available(iOS 10.0, *), let countryCode = currentLocale.regionCode {
return countryCode.uppercased()
} else {
if let countryCode = (currentLocale as NSLocale).object(forKey: .countryCode) as? String {
return countryCode.uppercased()
Expand Down

0 comments on commit 915dc26

Please sign in to comment.