Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //TODO: Add it in appDelegate > didFinishLaunchingWithOptions
- extension UIApplication {
- class func isFirstLaunch() -> Bool {
- if !NSUserDefaults.standardUserDefaults().boolForKey("HasAtLeastLaunchedOnce") {
- NSUserDefaults.standardUserDefaults().setBool(true, forKey: "HasAtLeastLaunchedOnce")
- NSUserDefaults.standardUserDefaults().synchronize()
- return true
- }
- return false
- }
- }
- //TODO: Call it inside appDelegate before calling any other view controller
- if UIApplication.isFirstLaunch() {
- // do something on first launch
- }
Add Comment
Please, Sign In to add comment