title: set initial viewcontroller in appdelegate - swift
body: <p>I would like to set the initial viewcontroller from the appdelegate. I found a really good answer, however it's in Objective C and im having trouble achieving the same thing in swift.</p>
  
  <p><a href="https://stackoverflow.com/questions/10428629/programatically-set-the-initial-view-controller-using-storyboards">Programmatically set the initial view controller using Storyboards</a></p>
  
  <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
  {
      self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
  
      UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
  
      UIViewController *viewController = // determine the initial view controller here and instantiate   it with [storyboard instantiateViewControllerWithIdentifier:&lt;storyboard id&gt;];
  
      self.window.rootViewController = viewController;
      [self.window makeKeyAndVisible];
  
      return YES;
  }
  </code></pre>
  
  <p>Anyone able to  help?</p>
  
  <p>I want the initial Viewcontroller to be dependent on certain conditions being met using a conditional statement.</p>