Last active
August 29, 2015 14:23
-
-
Save burhanaksendir/2e84877396670533a5ba to your computer and use it in GitHub Desktop.
Main View Controller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override func viewDidLoad() { | |
super.viewDidLoad() | |
NSNotificationCenter.defaultCenter().addObserver(self, selector: "remoteNotificationReceiveAction:", name: "remoteNotificationReceived", object: nil) | |
} | |
func remoteNotificationReceiveAction(data: NSNotification) { | |
if let apsPayloadContent: AnyObject = data.userInfo as? AnyObject { | |
if let url: String = apsPayloadContent["imageURL"] as? String { | |
let notifyVC = self.storyboard?.instantiateViewControllerWithIdentifier("notify") as! NotifyViewController | |
notifyVC.imageURL = url | |
let presentingVC = UIApplication.sharedApplication().keyWindow?.rootViewController | |
if (presentingVC?.presentedViewController != nil) { | |
presentingVC?.presentedViewController?.presentViewController(notifyVC, animated: true, completion: nil) | |
} else { | |
presentingVC?.presentViewController(notifyVC, animated: true, completion: nil) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment