daily pastebin goal
13%
SHARE
TWEET

Untitled

a guest Sep 21st, 2018 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //TODO: Add it in appDelegate > didFinishLaunchingWithOptions
  2. extension UIApplication {
  3.     class func isFirstLaunch() -> Bool {
  4.         if !NSUserDefaults.standardUserDefaults().boolForKey("HasAtLeastLaunchedOnce") {
  5.             NSUserDefaults.standardUserDefaults().setBool(true, forKey: "HasAtLeastLaunchedOnce")
  6.             NSUserDefaults.standardUserDefaults().synchronize()
  7.             return true
  8.         }
  9.         return false
  10.     }
  11. }
  12.  
  13. //TODO: Call it inside appDelegate before calling any other view controller
  14. if UIApplication.isFirstLaunch() {
  15.     // do something on first launch
  16. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top