SubjectType

public struct SubjectType<Element, ErrorType> where ErrorType : Error

Abstraction over passthrough subject types (PassthroughSubject, PublishSubject, Signal) from reactive frameworks. This abstraction uses concept similar to type-erasure or protocol witness pattern, wrapping the behaviour of concrete implementations and delegating to them once the wrapper funcions are called.

  • Upstream publisher that feeds events into this subject

    Declaration

    Swift

    public let publisher: PublisherType<Element, ErrorType>
  • Downstream subscriber that subscribes to this subject and will receive events from it

    Declaration

    Swift

    public let subscriber: SubscriberType<Element, ErrorType>
  • Creates an abstraction over passthrough subject types (PassthroughSubject, PublishSubject, Signal) from reactive frameworks.

    Declaration

    Swift

    public init(publisher: PublisherType<Element, ErrorType>, subscriber: SubscriberType<Element, ErrorType>)

    Parameters

    publisher

    Upstream publisher that feeds events into this subject

    subscriber

    Downstream subscriber that subscribes to this subject and will receive events from it