FireAndForget

public struct FireAndForget<IgnoringOutput> : SignalProducerProtocol

Fire And Forget is a SignalProducer for when you don’t care about the output of certain async operation. It’s important to notice that this operation can’t fail. If you want to also ignore the failure, then you can catchErrors and return nil in the proper init. It may complete successfully when task is done.

  • Declaration

    Swift

    public typealias Value = IgnoringOutput
  • Declaration

    Swift

    public typealias Error = Never
  • Declaration

    Swift

    public let producer: SignalProducer<IgnoringOutput, Never>
  • Init a FireAndForget signal producer by providing a closure with the operation to execute and ignore the output.

    Declaration

    Swift

    public init(_ operation: @escaping () -> Void)

    Parameters

    operation

    any operation you want to run async and ignore the result

  • Init a FireAndForget signal producer by providing an upstream that never fails so we can simply ignore its output

    Declaration

    Swift

    public init<S>(_ upstream: S) where S : SignalProducerProtocol, S.Error == Never

    Parameters

    upstream

    any signal producer that never fails

  • Init a FireAndForget signal producer by providing an upstream that could fail, as well as a catchErrors function to ensure that FireAndForget can’t itself fail. You can safely return nil from catchErrors. Otherwise outputs sent from catch errors will NOT be ignored, only those from the happy path.

    Declaration

    Swift

    public init<S>(_ upstream: S, catchErrors: @escaping (S.Error) -> IgnoringOutput?) where S : SignalProducerProtocol