プッシュ通知の実装

AppDelegateの通知処理からViewControllerに処理を飛ばす方法です

userInfoを渡す処理になります

// AppDelegate
  func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject], fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) {

            let notification = NSNotification(
                name:"my_push",
                object: nil,
                userInfo:userInfo

            NSNotificationCenter.defaultCenter().postNotification(notification)
    }
//ViewController

override func viewDidAppear(animated: Bool) {
    NSNotificationCenter.defaultCenter().addObserver(self, selector: "handlePushNotification:", name: "my_push", object: nil)

}


override func viewDidDisappear(animated: Bool) {
    NSNotificationCenter.defaultCenter().removeObserver(self)
}

// observer fired
func handlePushNotification(notification: NSNotification) {
   // 通知の処理
}