Created
December 7, 2020 11:26
-
-
Save Amzd/2afac9a329d3fd0ca882d29f7c9adeac to your computer and use it in GitHub Desktop.
Empty and constant AnyPublisher extensions
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
@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) | |
extension AnyPublisher { | |
static var empty: Self { | |
Empty(completeImmediately: false).eraseToAnyPublisher() | |
} | |
static func constant(_ value: Output) -> Self where Failure == Never { | |
Just(value).eraseToAnyPublisher() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment