diff --git a/Blog/NotificationToSelectorMap.h b/Blog/NotificationToSelectorMap.h index b286516..d43744f 100644 --- a/Blog/NotificationToSelectorMap.h +++ b/Blog/NotificationToSelectorMap.h @@ -10,10 +10,10 @@ @interface NotificationToSelectorMap : NSObject -@property (nonatomic, copy) NSDictionary *notificationNameToSelectorNameMap; +@property (nonatomic, copy, nonnull) NSDictionary *notificationNameToSelectorNameMap; -- (instancetype)initWithNotificationMap:(nonnull NSDictionary *)notificationMap; -- (void)addObserver:(NSObject *)observer; -- (void)removeObserver:(NSObject *)observer; +- (nonnull instancetype)initWithNotificationMap:(nonnull NSDictionary *)notificationMap; +- (void)addObserver:(nonnull NSObject *)observer; +- (void)removeObserver:(nonnull NSObject *)observer; @end diff --git a/Blog/NotificationToSelectorMap.m b/Blog/NotificationToSelectorMap.m index bfec403..4f64b7b 100644 --- a/Blog/NotificationToSelectorMap.m +++ b/Blog/NotificationToSelectorMap.m @@ -10,7 +10,7 @@ @implementation NotificationToSelectorMap -- (instancetype)initWithNotificationMap:(nonnull NSDictionary *)notificationMap { +- (nonnull instancetype)initWithNotificationMap:(nonnull NSDictionary *)notificationMap { self = [super init]; if (self) { _notificationNameToSelectorNameMap = notificationMap; @@ -18,7 +18,7 @@ return self; } -- (void)addObserver:(NSObject *)observer { +- (void)addObserver:(nonnull NSObject *)observer { NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; for (NSString *notificationName in self.notificationNameToSelectorNameMap.allKeys) { NSString *selectorName = self.notificationNameToSelectorNameMap[notificationName]; @@ -26,7 +26,7 @@ } } -- (void)removeObserver:(NSObject *)observer { +- (void)removeObserver:(nonnull NSObject *)observer { NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; for (NSString *notificationName in self.notificationNameToSelectorNameMap.allKeys) { [notificationCenter removeObserver:observer name:notificationName object:nil];