0

I am trying to save the state of the user in User Defaults whether he/she has visited a particular View Controller or not, if the person has visited the view controller before i don't want to show the animation again. I went through stack over flow and couldn't find a suitable explanation for the problem i am facing.

Everytime i am going to the particular view controller, it is showing the animation. I only wanted the animation to appear when the user has been on the view controller for the first time.

Some users are saying to use AppDelegate , but i think that's only used to detect whether the application did finish with launching with options for the first time or not. I do know how to use User Defaults in other scenarios but i am stuck here.

Any help is appreciated. Thanks!

  • 1
    Related: https://stackoverflow.com/questions/26830285/ios-app-first-launch – vadian Jun 15 '19 at 10:36
  • @vadian I am not looking for "First launch of my app", i have already described that i have a particular view controller, for example if i navigate to that view controller it'll display an animation ONCE and no matter how many times the user kills the app from multi-tasking or navigates back , the animation won't show up. I want to use User Defaults there. Thank you for the reply though. – CandiceS1992 Jun 15 '19 at 10:41
  • 1
    You wrote *I only wanted the animation to appear when the user has been on the view controller for the first time*. Practically that's the same thing as *first launch*. Rather than managing the Bool value in `AppDelegate` do it in the view controller right before navigating to the other view controller. – vadian Jun 15 '19 at 10:45
  • @vadian Thank you, i'll try it now! – CandiceS1992 Jun 15 '19 at 10:48

0 Answers0