How to get system device language, using swift iOS, Not app language, that I am handing no issue.

I want to get device language from Setting -> General -> Language that user set language to.

I tried below code:

let appLang = Locale.preferredLanguages
print("appLang ======== (appLang)")

let bungleLang = Bundle.main.preferredLocalizations
print("bungleLang ======== (bungleLang)")

let code = Locale.autoupdatingCurrent.languageCode
print("code ======== (code ?? "")")

if let code = Locale.current.languageCode {
    print("Locale.current.languageCode ======== (code)")

print("currentLanguage ======== (Localize.currentLanguage())")

let local = getPreferredLocale()
print("local ======== (local)")
print("languageCode = (local.languageCode ?? "")")
print("regionCode = (local.regionCode ?? "")")


appLang ======== ["en"]
bungleLang ======== ["en"]
code ======== en
Locale.current.languageCode ======== en
currentLanguage ======== en
local ======== en (fixed)
languageCode = en
regionCode = 

So I am not getting device language what ever the user set in his device settings.


Is it possible or not? I tried everything.

All code getting only

or English, but if the user set the language to Italian then? How we can get Italian or

Note: Again I am saying I am not talking about app language, I am talking about device language.

Edit: Not working in simulator and real device both Checked in Simulator iPhone 11, OS 14.4 Checked in Real Device iPhone 7, OS 13.3 Xcode Version 12.4

Anonymous Asked question May 13, 2021