Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Implemented `setOutputType`.
extension Publisher where Output == Never {
func setOutputType<NewOutput>(to outputType: NewOutput.Type) /// (1) For the uninitiated, the `.Type`
/// and `.self` suffixes here and at (2) refer to a metatype type and a type as a value,
/// respectively. The language reference has a
/// [solid section]( on the topic.
-> Publishers.Map<Self, NewOutput> {
map { _ -> NewOutput in }
.setOutputType(to: String.self) /// (2) Fixing downstream’s output type to `String`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.