ValidatedSubject
public class ValidatedSubject<T, S> : Subject where T == S.Output, S : Subject, S.Failure == Never
ValidatedSubject
A base class that can be used to wrap any Subject type and sends validated objects to downstream subscribers.
-
The output type.
Declaration
Swift
public typealias Output = T -
The failure type.
Declaration
Swift
public typealias Failure = Never -
The validator used to validate objects before sending them to downstream subscribers.
Declaration
Swift
public let validator: Validator<T> -
Initializes a new instance.
Declaration
Swift
public init(validator: Validator<T>, subject: S)Parameters
validatorThe validator to use to validate objects.
subjectThe
Subjecttype we are wrapping. -
Validates the value before sending it to downstream subscribers.
See also
SubjectDeclaration
Swift
public func send(_ value: T)Parameters
valueThe value to validate before sendiing downstream.
-
Signals a completion.
See also
SubjectDeclaration
Swift
public func send(completion: Subscribers.Completion<Failure>) -
Attaches a new subscription.
See also
SubjectDeclaration
Swift
public func send(subscription: Subscription)
ValidatedSubject Class Reference