Publisher
public extension Publisher where Output == Action
Operators for narrowing down Action
s in Publisher streams.
-
Only lets
Action
s of a certain type get through the stream.actions .ofType(FetchTodosAction.self) .sink(receiveValue: { action in print("This is a FetchTodosAction: \(action)") })
Declaration
Swift
func ofType<T>(_ typeToMatch: T.Type) -> AnyPublisher<T, Self.Failure>
Parameters
typeToMatch
A type of
Action
to match -
Only lets
Action
s created from the givenActionTemplate
s get through the stream.actions .wasCreated(from: fetchTodosActionTemplate) .sink(receiveValue: { action in print("This is a FetchTodosAction: \(action)") })
Declaration
Swift
func wasCreated<Payload>(from actionTemplate: ActionTemplate<Payload>) -> AnyPublisher<AnonymousAction<Payload>, Self.Failure>
Parameters
actionTemplate
An
ActionTemplate
to check -
Only lets
AnonymousAction
s with a certain identifier get through the stream.actions .withIdentifier("FetchTodosAction") .sink(receiveValue: { action in print("This is an AnonymousAction with the id 'FetchTodosAction': \(action)") })
Declaration
Swift
func withIdentifier(_ identifierToMatch: String) -> AnyPublisher<Action, Self.Failure>
Parameters
identifierToMatch
A identifier to match