Repeat

public struct Repeat : Shortcut

Repeats the contained actions, running them either a specified number of times or once for each item in an input list.

Input: (Anything) a list of items (optional)

Result: (Anything) Every item passed to the “End Repeat” action

  • The contents of the shortcut.

    Declaration

    Swift

    public var body: some Shortcut { get }
  • Initializes the shortcut.

    Declaration

    Swift

    public init<Content>(count: Int, groupingIdentifier: UUID = UUID(), @ShortcutBuilder builder: (_ repeatIndex: Variable) -> Content) where Content : Shortcut

    Parameters

    count

    The number of times to repeat the actions.

    groupingIdentifier

    An optional UUID, useful for building deterministic output.

    builder

    The shortcut builder that creates shortcuts.

    repeatIndex

    The index of current iteration as a variable.

  • Initializes the shortcut.

    Declaration

    Swift

    public init<Content>(iterating variable: Variable, groupingIdentifier: UUID = UUID(), @ShortcutBuilder builder: (_ repeatIndex: Variable, _ repeatItem: Variable) -> Content) where Content : Shortcut

    Parameters

    variable

    An input list to iterate.

    groupingIdentifier

    An optional UUID, useful for building deterministic output.

    builder

    The shortcut builder that creates shortcuts.

    repeatIndex

    The index of current iteration as a variable.

    repeatItem

    The currently iterated item as a variable.