SignalProducerProtocol
protocol SignalProducerProtocol
-
Make the
SignalProducer
output optionalValue
.Declaration
Swift
public func promoteOptional() -> SignalProducer<Value?, Error>
-
Make the
Signal
output optionalValue
, and prefix it withnil
.Declaration
Swift
public func prefixNil() -> SignalProducer<Value?, Error>
-
Returns a SignalProducer which cannot fail. Errors that would be otherwise be sent in the original producer are ignored.
Declaration
Swift
public func ignoreError() -> SignalProducer<Value, NoError>
-
Returns a SignalProducer that when started will delay starting of the original producer on given scheduler.
Declaration
Swift
public func delayStart(_ interval: TimeInterval, on scheduler: DateScheduler) -> ReactiveSwift.SignalProducer<Value, Error>
Parameters
interval
The time interval after which to start the
SignalProducer
scheduler
The scheduler on which to start the
SignalProducer
after the delay has passed -
The original purpose of this method is to allow triggering animations in response to signal values.
Example
The following code
self.constraint.reactive.constant <~ viewModel.constraintConstantValue.signal.observe(context: animatingContext)
will result in all changes to
constraintConstantValue
inviewModel
to be reflected in the constraint and animated.Declaration
Swift
public func observe(context: @escaping (@escaping () -> Void) -> Void) -> SignalProducer<Value, Error>
Parameters
context
Defines a context in which observers of the resulting signal will be called.
Return Value
A signal of which observers will receive values in the context defined by
context
function.
-
Converts a
SignalProducer
that has aTransferState
value into aSignalProducer
only returning a value whenfinished()
is received.Declaration
Swift
public func ignoreLoading<Progress, Value>() -> SignalProducer<Value, Error> where Self.Value == TransferState<Progress, Value>
-
Maps a
SignalProducer
for which each value is aTransferState
into aTransferState
returning the mapped value.Declaration
Swift
public func mapFinished<Progress, Value, Mapped>(_ mapper: @escaping (Value) -> Mapped) -> SignalProducer<TransferState<Progress, Mapped>, Error> where Self.Value == TransferState<Progress, Value>
-
Maps a
SignalProducer
for which each value is aTransferState
into aTransferState
returning aSignalProducer
returning the mapped value.Declaration
Swift
public func flatMapFinished<Progress, Value, Mapped>(_ mapper: @escaping (Value) -> SignalProducer<Mapped, Error>) -> SignalProducer<TransferState<Progress, Mapped>, Error> where Self.Value == TransferState<Progress, Value>