Event
public enum Event<Value, Error: Swift.Error>
Represents a signal event.
Signals must conform to the grammar:
value* (failed | completed | interrupted)?
-
A value provided by the signal.
Declaration
Swift
case value(Value)
-
The signal terminated because of an error. No further events will be received.
Declaration
Swift
case failed(Error)
-
The signal successfully terminated. No further events will be received.
Declaration
Swift
case completed
-
Event production on the signal has been interrupted. No further events will be received.
Important
This event does not signify the successful or failed completion of the signal.Declaration
Swift
case interrupted
-
Whether this event is a completed event.
Declaration
Swift
public var isCompleted: Bool
-
Whether this event indicates signal termination (i.e., that no further events will be received).
Declaration
Swift
public var isTerminating: Bool
-
Lift the given closure over the event’s value.
Important
The closure is called only on
value
type events.Declaration
Swift
public func map<U>(_ f: (Value) -> U) -> Event<U, Error>
Parameters
f
A closure that accepts a value and returns a new value
Return Value
An event with function applied to a value in case
self
is avalue
type of event. -
Lift the given closure over the event’s error.
Important
The closure is called only on failed type event.
Declaration
Swift
public func mapError<F>(_ f: (Error) -> F) -> Event<Value, F>
Parameters
f
A closure that accepts an error object and returns a new error object
Return Value
An event with function applied to an error object in case
self
is a.Failed
type of event. -
Unwrap the contained
value
value.Declaration
Swift
public var value: Value?
-
Unwrap the contained
Error
value.Declaration
Swift
public var error: Error?
-
Unwrap the contained
Error
value.Declaration
Swift
public var description: String
-
Extracts the event from the receiver.
Declaration
Swift
public var event: Event<Value, Error>