From 915dc2662258fed8e1119fd1e8b6273e8433112d Mon Sep 17 00:00:00 2001 From: Roy Marmelstein Date: Fri, 16 Dec 2016 07:56:22 +0100 Subject: [PATCH] [#96] Fixing incorrect country code fallback --- PhoneNumberKit/PhoneNumberKit.swift | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/PhoneNumberKit/PhoneNumberKit.swift b/PhoneNumberKit/PhoneNumberKit.swift index 924069771..d3b7c6868 100644 --- a/PhoneNumberKit/PhoneNumberKit.swift +++ b/PhoneNumberKit/PhoneNumberKit.swift @@ -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()