ReplaySubject
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
public final class ReplaySubject<Output, Failure> where Failure : Error
extension ReplaySubject: Publisher
extension ReplaySubject: Subject
A subject that maintains a buffer of its latest values for replay to new subscribers and passes through subsequent elements and completion
The subject passes through elements and completion states unchanged and in addition replays the latest elements to any new subscribers. Use this subject when you want subscribers to receive the most recent previous elements in addition to all future elements.
-
Declaration
Swift
public init(maxBufferSize: Int)
Parameters
maxBufferSize
The number of elements that should be buffered for replay to new subscribers
Return Value
A subject that maintains a buffer of its recent values for replay to new subscribers and passes through subsequent values and completion
-
Declaration
Swift
public func receive<S>(subscriber: S) where Output == S.Input, Failure == S.Failure, S : Subscriber
-
Declaration
Swift
public func send(subscription: Subscription)
-
Declaration
Swift
public func send(_ value: Output)
-
Declaration
Swift
public func send(completion: Subscribers.Completion<Failure>)