Send

A type that can send actions back into the system when used from run(priority:operation:catch:fileID:filePath:line:column:).

Effect.swift:188
@MainActor struct Send<Action>

This type implements callAsFunction so that you invoke it as a function rather than calling methods on it:

return .run { send in
  await send(.started)
  for await event in self.events {
    send(.event(event))
  }
  await send(.finished)
}

You can also send actions with animation and transaction:

await send(.started, animation: .spring())
await send(.finished, transaction: .init(animation: .default))

See run(priority:operation:catch:fileID:filePath:line:column:) for more information on how to use this value to construct effects that can emit any number of times in an asynchronous context.