Guest User

Untitled

a guest
Jul 17th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. override func viewDidLoad() {
  2. super.viewDidLoad()
  3. let checkForFirstTimeLaunch = UserDefaults.standard.string(forKey: "Flag")
  4.  
  5. if checkForFirstTimeLaunch == false {
  6. print("First time launch")
  7.  
  8. //if user launches app for the first time, it will go here
  9. let PageViewController = self.storyboard?.instantiateViewController(withIdentifier: "PageViewController") as! PageViewController
  10.  
  11. self.present(PageViewController, animated: true)
  12. } else {
  13. //otherwise, it will go here
  14. let HomeViewController = self.storyboard?.instantiateViewController(withIdentifier: "HomeViewController") as! HomeViewController
  15.  
  16. self.present(HomeViewController, animated: true)
  17. }
  18. }
  19.  
  20. if checkForFirstTimeLaunch == nil {
  21. //First time launch
  22. } else {
  23. //Not first time launch
  24. }
  25.  
  26. let firstTimeLaunch = UserDefaults.standard.bool(forKey: "Flag")
  27.  
  28. if firstTimeLaunch == false {
  29. //first time launch
  30. } else {
  31. //not first time launch
  32. }
Add Comment
Please, Sign In to add comment