Skip to content

Instantly share code, notes, and snippets.

@embassem
Forked from ahmedk92/main.swift
Created May 13, 2018 14:32
Show Gist options
  • Save embassem/ed45bfc80492f653d14d01396487e778 to your computer and use it in GitHub Desktop.
Save embassem/ed45bfc80492f653d14d01396487e778 to your computer and use it in GitHub Desktop.
Set default app language
class MyApplication: UIApplication {
override init() {
let notFirstOpenKey = "notFirstOpen"
let notFirstOpen = UserDefaults.standard.bool(forKey: notFirstOpenKey)
if notFirstOpen == false {
UserDefaults.standard.set(["ar"], forKey: "AppleLanguages")
UserDefaults.standard.set(true, forKey: notFirstOpenKey)
}
super.init()
}
}
UIApplicationMain(
CommandLine.argc,
UnsafeMutableRawPointer(CommandLine.unsafeArgv)
.bindMemory(
to: UnsafeMutablePointer<Int8>.self,
capacity: Int(CommandLine.argc)
),
NSStringFromClass(MyApplication.self),
NSStringFromClass(AppDelegate.self)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment