Publisher
public extension Publisher
Publisher constants
Version
1.0.0Date
18/11/22-
An empty publisher with the current publisher output and failure.
Declaration
Swift
static var empty: AnyPublisher<Output, Failure> { get }
-
Sink a publisher and record any result in
PublisherResult
Declaration
Swift
func test() -> PublisherResult<Output, Failure>
Return Value
The object that contains any events happening in the result
-
Attaches a subscriber with closure-based behavior.
Declaration
Swift
func sink(receiveFinished: @escaping () -> Void = {}, receiveFailure: @escaping (Failure) -> Void = { _ in }, receiveValue: @escaping (Output) -> Void = { _ in }) -> AnyCancellable
Parameters
receiveFinished
The closure to execute on finishing
receiveFailure
The closure to execute on receipt of a failure
receiveValue
The closure to execute on receipt of a value
Return Value
A cancellable instance; used when you end assignment of the received value. Deallocation of the result will tear down the subscription stream.
-
Map any error into a specific error.
Declaration
Swift
func mapError<E>(into error: E) -> AnyPublisher<Output, E> where E : Error
Parameters
error
Default error case if the detected error has a different error type.
Return Value
The publisher with the new error type.
-
Ignore errors occur in the publisher.
Declaration
Swift
func ignoreError() -> AnyPublisher<Output, Never>
Return Value
The publisher with no error.
-
Remove all nil values from the stream
Declaration
Swift
func removeNil<O>() -> AnyPublisher<O, Failure> where Self.Output == O?
Return Value
The publisher with no nil value.