Call a UIViewController with NavigationController programmatically in SWIFT 2.x
<p>I want to call a UIViewController with NavigationController designed in Storyboard programmatically when I select a dynamic shortcut.</p>

<p>I designed my UIViewController and its NavigationController in Main.storyboard and I put a storyboard ID (I called it MyUICtrlStoryID)</p>

<p>In order to create my dynamic shortcut I wrote the following code in the AppDelegate:</p>

<pre><code>@available(iOS 9.0, *)
    func application(application: UIApplication, performActionForShortcutItem shortcutItem: UIApplicationShortcutItem, completionHandler: Bool -&gt; Void) {




        let handledShortCutItem = shortcutItem.type // handleShortCutItem(shortcutItem)

        if handledShortCutItem == "3DTouchShourtcutID"{

            self.window = UIWindow(frame: UIScreen.mainScreen().bounds)

            let storyboard = UIStoryboard(name: "Main", bundle: nil)

//FirstViewcontroller UI will be called as root UIView
            let initialViewControlleripad : FirstViewController = storyboard.instantiateViewControllerWithIdentifier("FirstViewControllerID") as! FirstViewController



            initialViewControlleripad.go2MySecondUI = true   //set this check variable in order to launch my second UI View from the first one.

            self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
            self.window?.rootViewController = initialViewControlleripad
            self.window?.makeKeyAndVisible()
        }
      }
</code></pre>

<p>in the viewWillAppear function of my FistViewController</p>

<pre><code>if #available(iOS 9.0, *) {

                let shortcutItem = UIApplicationShortcutItem(type: "3DTouchShortcutID",
                    localizedTitle:    "This action",
                    localizedSubtitle: "action description",
                    icon: UIApplicationShortcutIcon(type: UIApplicationShortcutIconType.Add),
                    userInfo: nil)


                UIApplication.sharedApplication().shortcutItems = [shortcutItem]

                //check if FirstViewControler had to call the second UI 
                if go2MySecondUI == true {
                    self.go2MySecondUI = false


                            let newViewCtrl = self.storyboard?.instantiateViewControllerWithIdentifier("MyUICtrlStoryID") as? SecondViewController
                           // call second UI view

                   dispatch_async(dispatch_get_main_queue()) {
                       self.presentViewController(newViewCtrl!, animated: true, completion: nil)
                   }
                                              //  }
                }
</code></pre>

<p>This code works fine: when I select, by 3d touch, my shortcut, my secondviewcontroller will be call and its UIView will be showed .. but without its navigation controller.
otherwise if I call my secondUIcontroller by a button designed in storyboard (with related segue callback) the secondUIView will be showed with navigation controller correctly..</p>

<p>What is wrong?</p>