Created
May 6, 2022 14:55
-
-
Save petermolnar-dev/d8dddf4864a8b35d7e256f55e53cbf0c to your computer and use it in GitHub Desktop.
CountryDetector_Original
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import CoreTelephony | |
class CountryDetector { | |
var telephonyInfo = CTTelephonyNetworkInfo() | |
func detectCountryWithoutLocation() -> String? { | |
guard let provider = telephonyInfo.serviceSubscriberCellularProviders?.first(where: { $0.value.isoCountryCode != nil })?.value else { | |
return nil | |
} | |
return provider.isoCountryCode | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment