title: What is the best way to present lock screen in iOS?
body: <p>I wondering the best way to present lock screen in iOS(swift).</p>
  
  <p>ex) If the user presses the home button or receives a call, I want to display the lock screen when user re-enter the app.</p>
  
  <p>So, I tried this way.</p>
  
  <pre><code>func applicationWillResignActive(_ application: UIApplication) {
      guard let passcodeManageView = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "passcodeManageView") as? PasscodeManageViewController else { return }
  
      if let window = self.window, let rootViewController = window.rootViewController {
          var currentController = rootViewController
          while let presentController = currentController.presentedViewController {
              currentController = presentController
          }
          currentController.present(passcodeManageView, animated: true, completion: nil)
      }
  }
  </code></pre>
  
  <p>Actually it works pretty well. </p>
  
  <p>However, if the alert window is displayed, it does not work normally.</p>
  
  <p>How can I fixed it? (Sorry for my eng.)</p>