Effect
public struct Effect
Configures an Effect from a source function and a dispatch option.
Effects are used for side-effects in ReCombine applications. See the Architecture section of the official documentation for more.
let successEffect = Effect(dispatch: false) { (actions: AnyPublisher<Action, Never>) -> AnyPublisher<Action, Never> in
actions
.ofType(GetPostsSuccess.self)
.handleEvents(receiveOutput: { _ in print("Got it") })
.eraseActionType()
.eraseToAnyPublisher()
}
-
When true, the emitted actions from the
source
Action Publisher will be dispatched to the store. If false, the emitted actions will be ignored.Declaration
Swift
public let dispatch: Bool