Guest User

Untitled

a guest
Sep 21st, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  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. }
Add Comment
Please, Sign In to add comment