title: How to set Root View Controller programatically in Objective C?
body: <p>I am a newbie in iOS Development trying to learn how to create and set views programmatically.</p>
  
  <p>i am trying to do swift statement in Obj-C </p>
  
  <pre><code>window?.rootViewController = UINavigationController(rootViewController : ViewController()) 
  </code></pre>
  
  <p>Project: Single View Application . Trying to link default Created ViewController.h</p>
  
  <p>As per Krunals Answer i updated code but Navigation Controller is not shown in simulator</p>
  
  <p>Cmd+Click on controller does not navigate to ViewController File </p>
  
  <pre><code>#import "AppDelegate.h"
  #import "ViewController.h"
  
  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  UIScreen *screen=[[UIScreen alloc]init];
      UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
  
      self.window.makeKeyAndVisible;
  
  
  
  
      ViewController *controller = [[ViewController alloc] init];
  
  
  
      window.rootViewController = [[UINavigationController alloc] initWithRootViewController:controller] ;
  </code></pre>