diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2019-09-30 09:27:12 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-30 09:27:12 -0400 |
commit | 398952c0d103b06faf5c49f354b56df33cba1c1e (patch) | |
tree | d675f943a29865b85f88062d5c9fb7c27e6b9709 | |
parent | 8b86dccb51c8714e8dfcc50691eaccfe50acf81a (diff) | |
parent | 8e457faffb4bfeb674cce073da867c23d8d5f13c (diff) | |
download | sdl_ios-398952c0d103b06faf5c49f354b56df33cba1c1e.tar.gz |
Merge pull request #1415 from smartdevicelink/fix/issue-1414-CancelInteraction-inits
changing inits to class methods to fix swift formatting issues
-rw-r--r-- | SmartDeviceLink/SDLCancelInteraction.h | 8 | ||||
-rw-r--r-- | SmartDeviceLink/SDLCancelInteraction.m | 16 | ||||
-rw-r--r-- | SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLCancelInteractionSpec.m | 16 |
3 files changed, 20 insertions, 20 deletions
diff --git a/SmartDeviceLink/SDLCancelInteraction.h b/SmartDeviceLink/SDLCancelInteraction.h index f545b2df9..d8f9078d2 100644 --- a/SmartDeviceLink/SDLCancelInteraction.h +++ b/SmartDeviceLink/SDLCancelInteraction.h @@ -71,28 +71,28 @@ NS_ASSUME_NONNULL_BEGIN @return A SDLCancelInteraction object */ -- (instancetype)initWithAlert; ++ (instancetype)alert; /** Convenience init for dismissing the currently presented slider. @return A SDLCancelInteraction object */ -- (instancetype)initWithSlider; ++ (instancetype)slider; /** Convenience init for dismissing the currently presented scrollable message. @return A SDLCancelInteraction object */ -- (instancetype)initWithScrollableMessage; ++ (instancetype)scrollableMessage; /** Convenience init for dismissing the currently presented perform interaction. @return A SDLCancelInteraction object */ -- (instancetype)initWithPerformInteraction; ++ (instancetype)performInteraction NS_SWIFT_NAME(performInteraction()); /** The ID of the specific interaction to dismiss. If not set, the most recent of the RPC type set in functionID will be dismissed. diff --git a/SmartDeviceLink/SDLCancelInteraction.m b/SmartDeviceLink/SDLCancelInteraction.m index 31a9ae613..40de4fbef 100644 --- a/SmartDeviceLink/SDLCancelInteraction.m +++ b/SmartDeviceLink/SDLCancelInteraction.m @@ -65,20 +65,20 @@ NS_ASSUME_NONNULL_BEGIN return [self initWithFunctionID:[SDLFunctionID.sharedInstance functionIdForName:SDLRPCFunctionNamePerformInteraction].unsignedIntValue cancelID:cancelID]; } -- (instancetype)initWithAlert { - return [self initWithFunctionID:[SDLFunctionID.sharedInstance functionIdForName:SDLRPCFunctionNameAlert].unsignedIntValue]; ++ (instancetype)alert { + return [[self alloc] initWithFunctionID:[SDLFunctionID.sharedInstance functionIdForName:SDLRPCFunctionNameAlert].unsignedIntValue]; } -- (instancetype)initWithSlider { - return [self initWithFunctionID:[SDLFunctionID.sharedInstance functionIdForName:SDLRPCFunctionNameSlider].unsignedIntValue]; ++ (instancetype)slider { + return [[self alloc] initWithFunctionID:[SDLFunctionID.sharedInstance functionIdForName:SDLRPCFunctionNameSlider].unsignedIntValue]; } -- (instancetype)initWithScrollableMessage { - return [self initWithFunctionID:[SDLFunctionID.sharedInstance functionIdForName:SDLRPCFunctionNameScrollableMessage].unsignedIntValue]; ++ (instancetype)scrollableMessage { + return [[self alloc] initWithFunctionID:[SDLFunctionID.sharedInstance functionIdForName:SDLRPCFunctionNameScrollableMessage].unsignedIntValue]; } -- (instancetype)initWithPerformInteraction { - return [self initWithFunctionID:[SDLFunctionID.sharedInstance functionIdForName:SDLRPCFunctionNamePerformInteraction].unsignedIntValue]; ++ (instancetype)performInteraction { + return [[self alloc] initWithFunctionID:[SDLFunctionID.sharedInstance functionIdForName:SDLRPCFunctionNamePerformInteraction].unsignedIntValue]; } - (void)setCancelID:(nullable NSNumber<SDLInt> *)cancelID { diff --git a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLCancelInteractionSpec.m b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLCancelInteractionSpec.m index 63bcce755..c36c5de29 100644 --- a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLCancelInteractionSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLCancelInteractionSpec.m @@ -103,29 +103,29 @@ describe(@"Getter/Setter Tests", ^{ expect(testRequest.cancelID).to(equal(testCancelID)); }); - it(@"Should initialize correctly with initWithAlert:", ^{ - testRequest = [[SDLCancelInteraction alloc] initWithAlert]; + it(@"Should initialize correctly with alert:", ^{ + testRequest = [SDLCancelInteraction alert]; expect(testRequest.functionID).to(equal([SDLFunctionID.sharedInstance functionIdForName:SDLRPCFunctionNameAlert])); expect(testRequest.cancelID).to(beNil()); }); - it(@"Should initialize correctly with initWithSlider:", ^{ - testRequest = [[SDLCancelInteraction alloc] initWithSlider]; + it(@"Should initialize correctly with slider:", ^{ + testRequest = [SDLCancelInteraction slider]; expect(testRequest.functionID).to(equal([SDLFunctionID.sharedInstance functionIdForName:SDLRPCFunctionNameSlider])); expect(testRequest.cancelID).to(beNil()); }); - it(@"Should initialize correctly with initWithScrollableMessage:", ^{ - testRequest = [[SDLCancelInteraction alloc] initWithScrollableMessage]; + it(@"Should initialize correctly with scrollableMessage:", ^{ + testRequest = [SDLCancelInteraction scrollableMessage]; expect(testRequest.functionID).to(equal([SDLFunctionID.sharedInstance functionIdForName:SDLRPCFunctionNameScrollableMessage])); expect(testRequest.cancelID).to(beNil()); }); - it(@"Should initialize correctly with initWithPerformInteraction:", ^{ - testRequest = [[SDLCancelInteraction alloc] initWithPerformInteraction]; + it(@"Should initialize correctly with performInteraction:", ^{ + testRequest = [SDLCancelInteraction performInteraction]; expect(testRequest.functionID).to(equal([SDLFunctionID.sharedInstance functionIdForName:SDLRPCFunctionNamePerformInteraction])); expect(testRequest.cancelID).to(beNil()); |