0

I am building an iPhone app in Xcode 8 with Swift 3. When the user first opens the app, there is a home screen followed by a screen prompting the user to enter some information that is stored on the device. When the use the app in the future, this second screen should be bypassed and move on to a third screen. I cannot figure out how to do this but tried adding a conditional checking whether second screen was visited in the app delegate and this second screen to no avail. Any help?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Noah Omdal
  • 89
  • 12

1 Answers1

0

If I am understanding well, your question is how to know if the user has already visited the second view.

You can store a key in NSUserDefaults

https://developer.apple.com/reference/foundation/userdefaults

When you want to set that the user has visited the second view.

let defaults = UserDefaults.standard
defaults.set("true", forKey: "notFirstTime")

When you want to check if he has already visited the second view. You have to check it in the AppDelegate didFinishLaunchingWithOptions method

if (defaults.object(forKey: "notFirstTime") != nil) {
    // Skip SecondView
}
else {// show second View
}
Pablo Sanchez Gomez
  • 1,438
  • 16
  • 28