Skip to content

Instantly share code, notes, and snippets.

@chosa91
Created September 27, 2021 16:30
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 chosa91/5150b2cf8bbdcfc2992a24c370f7659f to your computer and use it in GitHub Desktop.
Save chosa91/5150b2cf8bbdcfc2992a24c370f7659f to your computer and use it in GitHub Desktop.
Publisher extension
import Combine
extension Publisher {
func withInitialValue(_ value: Output) -> AnyPublisher<Output, Failure> {
merge(with: Just(value).setFailureType(to: Failure.self)).eraseToAnyPublisher()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment