Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- override func viewDidLoad() {
- super.viewDidLoad()
- let checkForFirstTimeLaunch = UserDefaults.standard.string(forKey: "Flag")
- if checkForFirstTimeLaunch == false {
- print("First time launch")
- //if user launches app for the first time, it will go here
- let PageViewController = self.storyboard?.instantiateViewController(withIdentifier: "PageViewController") as! PageViewController
- self.present(PageViewController, animated: true)
- } else {
- //otherwise, it will go here
- let HomeViewController = self.storyboard?.instantiateViewController(withIdentifier: "HomeViewController") as! HomeViewController
- self.present(HomeViewController, animated: true)
- }
- }
- if checkForFirstTimeLaunch == nil {
- //First time launch
- } else {
- //Not first time launch
- }
- let firstTimeLaunch = UserDefaults.standard.bool(forKey: "Flag")
- if firstTimeLaunch == false {
- //first time launch
- } else {
- //not first time launch
- }
Add Comment
Please, Sign In to add comment