Skip to content

Instantly share code, notes, and snippets.

@jasdev
Last active March 30, 2020 19:04
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/cf5e768834e68c678585f6c8941d8c59 to your computer and use it in GitHub Desktop.
Save jasdev/cf5e768834e68c678585f6c8941d8c59 to your computer and use it in GitHub Desktop.
`Publisher.materialize` with value event handling.
extension Publisher {
func materialize() -> AnyPublisher<Event<Output, Failure>, Never> {
map(Event.value) /// (1) Leaning on Swift’s generation of static, injection
/// functions for each case. i.e. `Event.value: (Output) -> Event`.
/* … */
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment