Check below code. first we create window. then alloc init viewcontroller. and then alloc navigation controller with rootcontroller as viewcontroller. and Window's root controller as navigation controller.
var window: UIWindow?
var navC : UINavigationController?
var vc:ViewController?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool
{
// alloc init window
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
// view controller
self.vc = ViewController(nibName: "ViewController", bundle: nil);
// create navigation controller with root = vc.
self.navC = UINavigationController(rootViewController: self.vc!);
self.navC?.navigationBar.hidden = true;
// window's root controller as navigation controller.
self.window?.rootViewController = self.navC
self.window?.makeKeyAndVisible()
return true
}
Maybe this will help you.