Skip to content

Instantly share code, notes, and snippets.

@jasdev
Last active March 31, 2020 20:38
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
EventConvertible sketch.
protocol EventConvertible {
associatedtype Output
associatedtype Failure: Error
var event: Event<Output, Failure> { get }
}
extension Event: EventConvertible {
var event: Event<Output, Failure> { self }
}
extension Publisher where Output: EventConvertible {
func values() -> AnyPublisher<Output.Output, Never> { /// (1) With type-erased placeholders, for now.
fatalError("To be implemented.")
}
func errors() -> AnyPublisher<Output.Failure, Never> { /// (2) Same here.
fatalError("To be implemented.")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment