title: Navigate to next view controller after delay ios
body: <p>I want to navigate to next view controller after a delay of 3 seconds. It happens, but it happens twice!. This is my code.</p>
  
  <pre><code>override func viewWillAppear(_ animated: Bool) {
      let authToken =  UserDefaults.standard.object(forKey:"token") as? String ?? ""
  
  
      if (authToken.characters.count == 0) {
          self.perform(#selector(ClassName.navigateToMobileScreen), with: nil, afterDelay: 3)
      }
  }
  </code></pre>
  
  <p>I placed this in both viewDidLoad and viewDidAppear in different scenarios. What can be the problem with this?</p>