I am trying to get users country to help supporting good user experience in my program, is there any code to get the current location of a certain user in swift language.
Asked
Active
Viewed 1,688 times
1 Answers
0
You can use the Local.current
variable to get information on your user such as region code: Local.current.regionCode
, language code: Locale.current.languageCode
etc.
This is done without getting the specific location of the user and rather gets the information from the device settings.

Nathan
- 949
- 8
- 19
-
This will return the user preference, not its actual location – Leo Dabus Jul 19 '19 at 04:25
-
@LeoDabus are you just trying to get the users current location? Like `CLLocation`? – Nathan Jul 19 '19 at 04:28
-
I mean the user can set the device locale preference to anywhere. Btw I am not the OP – Leo Dabus Jul 19 '19 at 04:29