Skip to content

Instantly share code, notes, and snippets.

@jasdev
Created April 2, 2020 14:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasdev/8cbb99bb5fca5b12dfae49ce3df44a32 to your computer and use it in GitHub Desktop.
Save jasdev/8cbb99bb5fca5b12dfae49ce3df44a32 to your computer and use it in GitHub Desktop.
Implemented `Publisher.values` and `.errors`.
extension Publisher where Output: EventConvertible {
func values() -> Publishers.CompactMap<Self, Output.Output> {
compactMap(\.event.value)
}
func errors() -> Publishers.CompactMap<Self, Output.Failure> {
compactMap(\.event.error)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment