cs193p – Lecture #13 Application Lifecycle and Core Motion

Please note, this blog entry is from a previous course. You might want to check out the current one.

NSNotification

Notifications provide a way to react to asynchronous events. e.g.:

[swift]
NSNotificationCenter.defaultCenter()

func addObserverForName(String, // name of the "radio station"
object: AnyObject?, // broadcaster (or nil for "anyone")
queue: NSOperationQueue?) // queue to execute the closure on
{ (notification: NSNotification) -> Void in
let info: [NSObject:AnyObject]? = notification.userInfo // notification-specific information
}
[/swift]
Continue reading “cs193p – Lecture #13 Application Lifecycle and Core Motion”

Facebooktwittergoogle_plusredditpinterestlinkedintumblrmailFacebooktwittergoogle_plusredditpinterestlinkedintumblrmail