I created some simple system that if userdefaults have key "isWalkthroughPresented". If the key is false then show walkthourghViewController. If it doesn't have the key then check from database.
However it doesn't set the key after first time. But saves after some launches. What should be the problem?
This is the code I use inside viewDidAppear after user has signed in and sees second ViewController:
let userDefaults = UserDefaults.standard
if !userDefaults.bool(forKey: "isWalkthroughPresented") {
presentWalkthrough()
userDefaults.set(true, forKey: "isWalkthroughPresented")
}else{
checkIfCurrentUserHasOpenedTheAppBefore()//this just checks if user in db has the value
}