title: Swift code: how to launch a specific view controller after receiving a remote push notification
body: <p>In Swift, my <strong>main.storyboard</strong> had 2 view controllers (<code>mainVC</code>, <code>secondVC</code>), both embedded in their navigation controller. When receiving a remote push notification, how do I change code in <code>AppDelegate</code> to have the <code>secondV</code>C view controller launch everytime. I currently have code in post the notification in <code>didReceiveRemoteNotification</code>, and have code in the <code>secondVC</code> to add observer</p>
  
  <p>In <code>AppDelegate.swift</code>, my code is as follows:</p>
  
  <pre><code>func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -&gt; Bool
  {
      var type = UIUserNotificationType.Badge | UIUserNotificationType.Alert | UIUserNotificationType.Sound
      var setting = UIUserNotificationSettings(forTypes: type, categories: nil)
      UIApplication.sharedApplication().registerUserNotificationSettings(setting)
      UIApplication.sharedApplication().registerForRemoteNotifications()
      return true
  }
  func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
      NSNotificationCenter.defaultCenter().postNotificationName("MyNotificationType", object: nil, userInfo: userInfo)
  
  }
  </code></pre>
  
  <p>In the <code>secondVC</code>, I have code as follows:</p>
  
  <pre><code>override func viewWillAppear(animated: Bool) {
      println("viewWillAppear()")
      NSNotificationCenter.defaultCenter().addObserver(self, selector: "AuthenticateWithTouchID:", name: "MyNotificationType", object: nil)
  }
  override func viewWillDisappear(animated: Bool) {
      println("viewWillDISAPPER")
      NSNotificationCenter.defaultCenter().removeObserver(self, name: "MyNotificationType", object: nil)
  }
  </code></pre>