도래울

swift nsnotification 구현 본문

개발/iOS

swift nsnotification 구현

도래울 2016. 10. 20. 10:01

Send(Post) Notification

    NSNotificationCenter.defaultCenter().postNotificationName("NotificationIdentifier", object: nil)

Receive(Get) Notification

    NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(YourClassName.methodOfReceivedNotification(_:)), name:"NotificationIdentifier", object: nil)

Method handler for received Notification

func methodOfReceivedNotification(notification: NSNotification){
    //Take Action on Notification
}


Comments