觀察通知
迅速
func testNotification(notification: NSNotification) {
let userInfo = notification.userInfo
let myObject: MyObject = userInfo["someKey"]
}
Objective-C
- (void)testNotification:(NSNotification *)notification {
NSDictionary *userInfo = notification.userInfo;
MyObject *myObject = [userInfo objectForKey:@"someKey"];
}