Signal
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
public enum Signal<Input, Failure> where Failure : Error
extension Signal: SignalConvertible
extension Signal: Equatable where Input: Equatable, Failure: Equatable
A materialized representation of a Publishers output.
Upon a call to subscribe, a legal Publisher produces signals in strictly the following order:
- Exactly one ‘subscription’ signal.
- Followed by zero or more ‘input’ signals.
- Terminated finally by a single ‘completion’ signal.
-
Sent by a
Publisherto aSubscriberin acknowledgment of theSubscriber‘s subscription request.Declaration
Swift
case subscription -
The payload of a subscription. Zero to many
.input(_)signals may be produced during the lifetime of aSubscriber‘s subscription to aPublisher.Declaration
Swift
case input(Input) -
The final signal sent to a
Subscriberduring a subscription to aPublisher. Indicates termination of the stream as well as the reason.Declaration
Swift
case completion(Subscribers.Completion<Failure>)
-
Whether the signal indicates sequence completion
Declaration
Swift
var isCompletion: Bool { get } -
Returns a signal with a transformed input type and input element
Declaration
Swift
func mapInput<T>(_ transform: (Input) -> T) -> Signal<T, Failure>Parameters
transformA mapping closure.
transformaccepts an element of this signal’s input type as its parameter and returns a transformed value of the same or of a different type.Return Value
A signal with a transformed input type and input element
-
Returns a signal with a transformed failure type and completion element
Declaration
Swift
func mapFailure<T>(_ transform: (Failure) -> T) -> Signal<Input, T> where T : ErrorParameters
transformA mapping closure.
transformaccepts an element of this signal’s failure type as its parameter and returns a transformed error of the same or of a different type.Return Value
A signal with a transformed failure type and completion element
-
Declaration
Swift
public var signal: Signal<Input, Failure> { get }
-
Declaration
Swift
public static func == (lhs: Signal<Input, Failure>, rhs: Signal<Input, Failure>) -> Bool
View on GitHub
Signal Enumeration Reference