RSDUIActionHandlerObject
open class RSDUIActionHandlerObject : RSDUIActionHandler
RSDUIActionHandlerObject is intended as an abstract implementation of the action handler that implements
the Codable protocol.
-
A mapping dictionary of action type to action.
Declaration
Swift
public var actions: [RSDUIActionType : RSDUIAction]? -
A list of action types that should be hidden by default.
Declaration
Swift
public var shouldHideActions: [RSDUIActionType]? -
Base class initializer.
Declaration
Swift
public init() -
Customizable actions to return for a given action type. The
RSDStepControllercan use these to customize the display of buttons to the user. If nil,shouldHideAction()will be called to determine if the default action should be used or if the action button should be hidden.Declaration
Swift
open func action(for actionType: RSDUIActionType, on step: RSDStep) -> RSDUIAction?Parameters
actionTypeThe action type for the button.
stepThe step that the action is on.
Return Value
A custom UI action for this button. If nil, the default action will be used.
-
Should the action button be hidden? This implementation will check the
shouldHideActionsarray and returntrueif found. Otherwise, this implementation will returnnil.Declaration
Swift
open func shouldHideAction(for actionType: RSDUIActionType, on step: RSDStep) -> Bool?Parameters
actionTypeThe action type for the button.
stepThe step that the action is on.
Return Value
Whether or not the button should be hidden or
nilif there is no explicit action.
-
Initialize from a
Decoder. This decoding method will use theRSDFactoryinstance associated with the decoder to decode theactions.example:
// Example JSON for the `actions` coding. let json = """ { "actions": { "goForward": { "buttonTitle" : "Go, Dogs! Go!" }, "cancel": { "iconName" : "closeX" }, "learnMore": { "iconName" : "infoIcon", "url" : "fooInfo" }, "skip": { "buttonTitle" : "not applicable", "skipToIdentifier": "boo"} }, "shouldHideActions": ["goBackward"] } """.data(using: .utf8)! // our data in native (JSON) formatThrows
DecodingErrorDeclaration
Swift
public required init(from decoder: Decoder) throwsParameters
decoderThe decoder to use to decode this instance.
-
Define the encoder, but do not require protocol conformance of subclasses.
Throws
EncodingErrorDeclaration
Swift
open func encode(to encoder: Encoder) throwsParameters
encoderThe encoder to use to encode this instance.
View on GitHub
RSDUIActionHandlerObject Class Reference