Created
September 27, 2021 16:30
-
-
Save chosa91/5150b2cf8bbdcfc2992a24c370f7659f to your computer and use it in GitHub Desktop.
Publisher extension
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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