Event

public enum Event
extension Signal.Event: CustomStringConvertible
extension Signal.Event: EventProtocol
extension Signal.Event: Equatable where Value: Equatable, Error: Equatable

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 { get }
  • Whether this event indicates signal termination (i.e., that no further events will be received).

    Declaration

    Swift

    public var isTerminating: Bool { get }
  • 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) -> Signal<U, Error>.Event

    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 a value 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) -> Signal<Value, F>.Event where F : Error

    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? { get }
  • Unwrap the contained Error value.

    Declaration

    Swift

    public var error: Error? { get }
  • Declaration

    Swift

    public var description: String { get }
  • Declaration

    Swift

    public var event: Signal<Value, Error>.Event { get }

Available where Value: Equatable, Error: Equatable

  • Declaration

    Swift

    public static func == (lhs: Signal<Value, Error>.Event, rhs: Signal<Value, Error>.Event) -> Bool