Search code examples
swiftmultilingual

Is it possible to have two different UI for a program?


Is it possible to have a program built for two countries and change the appearance and language of the program due to the SIM card code on the device?


Solution

  • Yes. You can check user's language for this.

    Get the language key of localization:

    let preferredLanguage = NSLocale.preferredLanguages.first
    

    Also you can get country code.

    Also you can do it using user's location, but I think it is a bad approach. Location requires a lof of battery.