Skip to content

Instantly share code, notes, and snippets.

@jasdev
Last active April 20, 2020 15:22
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/fafd68b75bc85a5b1011d979f8821c25 to your computer and use it in GitHub Desktop.
Save jasdev/fafd68b75bc85a5b1011d979f8821c25 to your computer and use it in GitHub Desktop.
`Publisher.cher` without `autoconnect`ing.
extension Publisher {
func cher() -> Publishers.Multicast<Self, PassthroughSubject<Output, Failure>> {
multicast(PassthroughSubject.init) /// (1) Keen readers might be asking why we didn’t reach for
/// `CurrentValueSubject` here. The reason is two-fold, we’d then need to consider what its initial value
/// would be, and that’d do more than the plain ol’ `share` operator in that it’d _replay_ values to future
/// subscribers (before any completions), which, is what we’ll tackle soon!
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment