-
Within this initializer you need to use the payload from the
StandardActionto configure the state of your custom action type.Example:
init(_ standardAction: StandardAction) { self.twitterUser = decode(standardAction.payload!["twitterUser"]!) }Note
If you, as most developers, only use action serialization/deserialization during development, you can feel free to use the unsafe!operator.Declaration
Swift
init (_ standardAction: StandardAction) -
Use the information from your custom action to generate a
StandardAction. Thetypeof the StandardAction should typically match the type name of your custom action type. You also need to setisTypedActiontotrue. Use the information from your action’s properties to configure the payload of theStandardAction.Example:
func toStandardAction() -> StandardAction { let payload = ["twitterUser": encode(self.twitterUser)] return StandardAction(type: SearchTwitterScene.SetSelectedTwitterUser.type, payload: payload, isTypedAction: true) }Declaration
Swift
func toStandardAction() -> StandardAction
View on GitHub
Install in Dash
StandardActionConvertible Protocol Reference