IfChain

struct IfChain
extension IfChain : Equatable, Hashable, Identifiable, Node, Sendable

A chain of IfThen clauses that can be extended with elseIf or ended with orElse.

  • id

    The stable identity of the entity associated with this instance.

    Declaration

    Swift

    let id: String
  • The if-then clause of the IfChain.

    Declaration

    Swift

    let ifThen: IfThen
  • The else-if clauses of the IfChain. These will execute in order if the if-then clause is false.

    Declaration

    Swift

    let elseIfThens: [IfThen]
  • Adds an elseIf clause to the IfChain.

    Declaration

    Swift

    func elseIf(_ condition: TypedExpression<Bool>, _ node: @escaping () -> any Node) -> IfChain

    Parameters

    condition

    The boolean TypedExpression that must be true to proceed with the specified node.

    node

    A closure returning the Node to proceed with if the condition is true.

    Return Value

    The IfChain which can be extended with elseIf or ended with orElse.

  • Adds an orElse clause to the IfChain.

    Declaration

    Swift

    func orElse(_ node: @escaping () -> any Node) -> IfFlow

    Parameters

    node

    A closure returning the Node to proceed with if all preceding conditions in the chain are false.

    Return Value

    The completed IfFlow.