I’m working with PassthroughSubjects (whatever those are).
I’m guessing that you are dabbling in Combine.
< > usually indicate some kind of generic. The type(s) between the brackets are placeholder types in the definition and concrete types in the implementation.
So the definition
final class PassthroughSubject<Output, Failure> where Failure : Error
PassthroughSubject is a generic type that takes two placeholder types, referred to as
Failure (and it also indicates that
Failure has to be a type of
Whereas something like
var passthrough = PassthroughSubject<Int, Never>()
indicates that in this case the concrete type that replaces the
Output placeholder is an
Int and the concrete type for
What does "the concrete type for
I mean, I’d like my failure to be never, too.
It just means that that particular example of a
PassthroughSubject will never fail; it will always produce a value of whatever type its
Output is. This can be because the subject simply cannot fail (like, say if you use
PassthroughSubject<Void, Never> because all you care about is the occurrence of an event rather than a particular value) or because any error was handled as part of the Combine pipeline and will never make it to the end, for instance by using the
replaceError operator to ensure a valid value.
CurrentValueSubject can have a
Failure type that is some specific type of
PassthroughSubject<String, RegistrationError> or whatnot.