Callback

public protocol Callback : Action, Identifiable

Base protocol for Journey callbacks used as actions in a Journey step.

Conforms to Action, Identifiable, and Sendable. Each callback must be default-initializable and able to initialize itself from a JSON dictionary. The payload() method returns a serializable representation of the callback to send back to the server.

  • Required default initializer.

    Declaration

    Swift

    init()
  • initialize(with:) Default implementation, asynchronous

    Initializes this callback from a server-provided JSON dictionary and returns self (async variant).

    Default Implementation

    Declaration

    Swift

    func initialize(with json: [String : Any]) async -> any Callback

    Parameters

    json

    The raw JSON dictionary describing this callback instance.

  • id

    The unique identifier for this callback instance.

    Declaration

    Swift

    var id: String { get }
  • A dictionary payload representing this callback’s data for submission.

    Declaration

    Swift

    func payload() -> [String : Any]