title: How to get Current viewcontroller (currently Presenting) using storyboard id in swift programmatically?
body: <p>**How to get the presenting view controller in swift. I am using storyboard id.**And for presenting next viewcontroller how can I add to the hierarchy?</p>
  
  <p>I tried like this:</p>
  
  <pre><code>   let mainStoryboard = UIStoryboard(name: "Main", bundle: nil)
     let logincontroller  = mainStoryboard.instantiateViewControllerWithIdentifier("LoginViewController")
  
      if UIApplication.sharedApplication().keyWindow?.rootViewController.presentingViewController == logincontroller {
  
       let mainStoryboard = UIStoryboard(name: "Main", bundle: nil)
       let nextVC  = mainStoryboard.instantiateViewControllerWithIdentifier(storayboardIdentifier)
  
       self.presentViewController(nextVC, animated: true, completion: nil)
  
       }
  </code></pre>
  
  <p>In Appdelegate.swift </p>
  
  <pre><code>func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -&gt; Bool {
  
           if isLoggedin == false {
  
          self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
  
          let storyboard = UIStoryboard(name: "Main", bundle: nil)
  
          let initialViewController = storyboard.instantiateViewControllerWithIdentifier("LoginViewController")
  
          self.window?.rootViewController = initialViewController
  
  
          self.window?.makeKeyAndVisible()
  
          return true
      }
      else {
  
          self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
  
          let storyboard = UIStoryboard(name: "Main", bundle: nil)
  
          let initialViewController = storyboard.instantiateViewControllerWithIdentifier("HomeViewController")
  
          self.window?.rootViewController = initialViewController
          self.window?.makeKeyAndVisible()
  
          return true
   }
  
  }
  </code></pre>
  
  <p>The code works, it display the view but it still have a warning</p>
  
  <blockquote>
    <p>Failed to instantiate the default view controller for
    UIMainStoryboardFile 'Main' - perhaps the designated entry point is
    not set?</p>
  </blockquote>