The object
represent the object which posted the notification. userInfo
contains the additional information/data for the receiving object/function.
According to NSNotificationCenter Class Reference:
postNotificationName:object:userInfo:
Creates a notification with a given name, sender, and information and
posts it to the receiver.
Declaration
Swift
func postNotificationName(_ notificationName: String, object notificationSender: AnyObject?, userInfo userInfo: [NSObject : AnyObject]?)
Objective-C
- (void)postNotificationName:(NSString *)notificationName object:(id)notificationSender userInfo:(NSDictionary *)userInfo
Parameters
notificationName
The name of the notification.
notificationSender
The object posting the notification.
userInfo
Information about the the notification. May be nil.
Discussion
This method is the preferred method for posting notifications.
userInfos
ofNSNotification
you'll see thatobject
is the notification sender, anduserInfos
contains additional info. – Pringleobject
also can contains additional info. Is there difference? – Othilie