DecodeWorkflow

@propertyWrapper
public struct DecodeWorkflow<Aggregator> : Decodable where Aggregator : FlowRepresentableAggregator

A property wrapper to easily conform AnyWorkflow to Decodable.

Discussion

Swift’s Decodable implementation is often more friendly when all your properties conform to Decodable. While AnyWorkflow does not directly conform to Decodable, the DecodeWorkflow property wrapper makes it conform. This provides a convenient way for you to decode workflows as part of other payloads.

Example

A struct that decodes a workflow and some metadata

struct WorkflowServerResponse: Decodable {
   @DecodeWorkflow<MyCustomAggregator> var workflow: AnyWorkflow
   var workflowID: UUID
}
  • Declaration

    Swift

    public init(from decoder: Decoder) throws