-1

Soo.. I want to create an app. For example: When I launch the app for the very first time, I get asked what my nickname should be. This ViewController is displayed only then, after I insert my name or whatever, the ViewController is gone and the user wont see it never again.

My Question: How do I create the "first time launched ViewController" as I call them?

I hope you understand what I mean.

Thanks in advance.

ilija.trkulja
  • 147
  • 2
  • 9

1 Answers1

1

You could do this with UserDefaults.

    let hasAskedForNickname = UserDefaults.standard.bool(forKey: "askedNickname")
    if !hasAskedForNickname {
        UserDefaults.standard.set(true, forKey: "askedNickname")
        self.performSegue(withIdentifier: "showNickname", sender: nil)
    }
DrewG23
  • 427
  • 3
  • 11