diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2017-12-07 11:03:18 -0500 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2017-12-07 11:03:18 -0500 |
commit | b9312437cf360e78274b710575da7c74241f16cf (patch) | |
tree | 8750e8cecbdaa79718d146ba675ec45b31b40915 | |
parent | ba04e9a65f51e8684f2a9f53fc90372607fefc51 (diff) | |
download | sdl_ios-bug/issue_808_slider_recursion.tar.gz |
Update SDLSlider documentationbug/issue_808_slider_recursion
-rw-r--r-- | SmartDeviceLink/SDLSlider.h | 31 | ||||
-rw-r--r-- | SmartDeviceLink/SDLSlider.m | 7 |
2 files changed, 35 insertions, 3 deletions
diff --git a/SmartDeviceLink/SDLSlider.h b/SmartDeviceLink/SDLSlider.h index fa1dc7acc..c23606350 100644 --- a/SmartDeviceLink/SDLSlider.h +++ b/SmartDeviceLink/SDLSlider.h @@ -16,10 +16,37 @@ NS_ASSUME_NONNULL_BEGIN @interface SDLSlider : SDLRPCRequest +/** + Create an SDLSlider with only the number of ticks and position. Note that this is not enough to get a SUCCESS response. You must supply additional data. See below for required parameters. + + @param numTicks The number of ticks present on the slider. + @param position The default starting position of the slider. + @return An SDLSlider RPC Request. + */ - (instancetype)initWithNumTicks:(UInt8)numTicks position:(UInt8)position; +/** + Create an SDLSlider with all required data and a static footer (or no footer). + + @param numTicks The number of ticks present on the slider. + @param position The default starting position of the slider. + @param sliderHeader The header describing the slider. + @param sliderFooter A static footer with text, or nil for no footer. + @param timeout The length of time in milliseconds the popup should be displayed before automatically disappearing. + @return An SDLSlider RPC Request. + */ - (instancetype)initWithNumTicks:(UInt8)numTicks position:(UInt8)position sliderHeader:(NSString *)sliderHeader sliderFooter:(nullable NSString *)sliderFooter timeout:(UInt16)timeout; +/** + Create an SDLSlider with all required data and a dynamic footer (or no footer). + + @param numTicks The number of ticks present on the slider. + @param position The default starting position of the slider. + @param sliderHeader The header describing the slider. + @param sliderFooters An array of footers. This should be the same length as `numTicks` as each footer should correspond to a tick, or no footer if nil. + @param timeout The length of time in milliseconds the popup should be displayed before automatically disappearing. + @return An SDLSlider RPC Request. + */ - (instancetype)initWithNumTicks:(UInt8)numTicks position:(UInt8)position sliderHeader:(NSString *)sliderHeader sliderFooters:(nullable NSArray<NSString *> *)sliderFooters timeout:(UInt16)timeout; /** @@ -39,7 +66,7 @@ NS_ASSUME_NONNULL_BEGIN /** * @abstract A text header to display * - * Rquired, Max length 500 chars + * Required, Max length 500 chars */ @property (strong, nonatomic) NSString *sliderHeader; @@ -59,7 +86,7 @@ NS_ASSUME_NONNULL_BEGIN @property (strong, nonatomic, nullable) NSArray<NSString *> *sliderFooter; /** - * @abstract An App defined timeout + * @abstract An App defined timeout in milliseconds * * @discussion Indicates how long of a timeout from the last action (i.e. sliding control resets timeout). * diff --git a/SmartDeviceLink/SDLSlider.m b/SmartDeviceLink/SDLSlider.m index b1076b7be..800d65741 100644 --- a/SmartDeviceLink/SDLSlider.m +++ b/SmartDeviceLink/SDLSlider.m @@ -18,7 +18,12 @@ NS_ASSUME_NONNULL_BEGIN } - (instancetype)initWithNumTicks:(UInt8)numTicks position:(UInt8)position sliderHeader:(NSString *)sliderHeader sliderFooter:(nullable NSString *)sliderFooter timeout:(UInt16)timeout { - return [self initWithNumTicks:numTicks position:position sliderHeader:sliderHeader sliderFooters:@[sliderFooter] timeout:timeout]; + NSArray<NSString *> *footer = nil; + if (sliderFooter != nil) { + footer = @[sliderFooter]; + } + + return [self initWithNumTicks:numTicks position:position sliderHeader:sliderHeader sliderFooters:footer timeout:timeout]; } - (instancetype)initWithNumTicks:(UInt8)numTicks position:(UInt8)position sliderHeader:(NSString *)sliderHeader sliderFooters:(nullable NSArray<NSString *> *)sliderFooters timeout:(UInt16)timeout { |