summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMuller, Alexander (A.) <amulle19@ford.com>2017-03-01 13:50:16 -0800
committerMuller, Alexander (A.) <amulle19@ford.com>2017-03-01 13:50:16 -0800
commita8d07e3a5d50258d326b7b4263b46b38a02174ce (patch)
treeca89890750553ed774d9b8c284d496a7a7cc8d3f
parent254eddf6f5300e184fe8d645d53fc76191434745 (diff)
downloadsdl_ios-a8d07e3a5d50258d326b7b4263b46b38a02174ce.tar.gz
Added convenience methods for notification and response notification objects.
-rw-r--r--SmartDeviceLink/SDLRPCNotificationNotification.h8
-rw-r--r--SmartDeviceLink/SDLRPCNotificationNotification.m5
-rw-r--r--SmartDeviceLink/SDLRPCResponseNotification.h8
-rw-r--r--SmartDeviceLink/SDLRPCResponseNotification.m5
4 files changed, 26 insertions, 0 deletions
diff --git a/SmartDeviceLink/SDLRPCNotificationNotification.h b/SmartDeviceLink/SDLRPCNotificationNotification.h
index 6c548812a..4f163b0ac 100644
--- a/SmartDeviceLink/SDLRPCNotificationNotification.h
+++ b/SmartDeviceLink/SDLRPCNotificationNotification.h
@@ -19,6 +19,14 @@ NS_ASSUME_NONNULL_BEGIN
- (instancetype)initWithName:(NSString *)name object:(nullable id)object rpcNotification:(__kindof SDLRPCNotification *)notification;
+/**
+ *
+ * Returns whether or not the containing notification is a kind of class.
+ *
+ * @param aClass the class your are questioning
+ */
+- (BOOL)isNotificationKindOfClass:(Class)aClass;
+
@end
NS_ASSUME_NONNULL_END
diff --git a/SmartDeviceLink/SDLRPCNotificationNotification.m b/SmartDeviceLink/SDLRPCNotificationNotification.m
index 898580654..9b281d5b2 100644
--- a/SmartDeviceLink/SDLRPCNotificationNotification.m
+++ b/SmartDeviceLink/SDLRPCNotificationNotification.m
@@ -31,6 +31,11 @@ NS_ASSUME_NONNULL_BEGIN
return _userInfo[SDLNotificationUserInfoObject];
}
+- (BOOL)isNotificationKindOfClass:(Class)aClass {
+ NSAssert([self.notification isKindOfClass:aClass], @"A notification was sent with an unanticipated object");
+ return [self.notification isKindOfClass:aClass];
+}
+
@end
NS_ASSUME_NONNULL_END
diff --git a/SmartDeviceLink/SDLRPCResponseNotification.h b/SmartDeviceLink/SDLRPCResponseNotification.h
index 118d1f532..161dbd2ba 100644
--- a/SmartDeviceLink/SDLRPCResponseNotification.h
+++ b/SmartDeviceLink/SDLRPCResponseNotification.h
@@ -19,6 +19,14 @@ NS_ASSUME_NONNULL_BEGIN
- (instancetype)initWithName:(NSString *)name object:(nullable id)object rpcResponse:(__kindof SDLRPCResponse *)response;
+/**
+ *
+ * Returns whether or not the containing response is a kind of class.
+ *
+ * @param aClass the class your are questioning
+ */
+- (BOOL)isResponseKindOfClass:(Class)aClass;
+
@end
NS_ASSUME_NONNULL_END
diff --git a/SmartDeviceLink/SDLRPCResponseNotification.m b/SmartDeviceLink/SDLRPCResponseNotification.m
index 6d4be548a..09787b579 100644
--- a/SmartDeviceLink/SDLRPCResponseNotification.m
+++ b/SmartDeviceLink/SDLRPCResponseNotification.m
@@ -30,4 +30,9 @@
return _userInfo[SDLNotificationUserInfoObject];
}
+- (BOOL)isResponseKindOfClass:(Class)aClass {
+ NSAssert([self.response isKindOfClass:aClass], @"A notification was sent with an unanticipated object");
+ return [self.response isKindOfClass:aClass];
+}
+
@end