Unsuccessful detection of first app launching , how should I do it?
<p>I have an app and a walkthrough screen and I want to display the walkthrough screen if the user's open the app for first time, but I do it wrong. Should I put the code in the AppDelegate or in the ViewDidLoad inside my first screen. 
Here is the code I used:</p>

<pre><code>  super.viewDidLoad()

    if UserDefaults.standard.bool(forKey: "isFirstLaunch") {

        UserDefaults.standard.set(true, forKey: "isFirstLaunch")
        UserDefaults.standard.synchronize()
    }
    let isFirstLaunch = UserDefaults.standard.value(forKey: "isFirstLaunch") as? Bool
    if isFirstLaunch! {

            let mainStoryboard = UIStoryboard(name: "ViewController", bundle: Bundle.main)
            let vc : ViewController = mainStoryboard.instantiateViewController(withIdentifier: "ViewController") as! ViewController
            self.present(vc, animated: true, completion: nil)


    }
</code></pre>

<p>and a picture of the error:</p>

<p><a href="https://i.stack.imgur.com/aUEPJ.png" rel="nofollow"><img src="https://i.stack.imgur.com/aUEPJ.png" alt="enter image description here"></a></p>

<p>Any ides how to do it?</p>