You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was looking at for something like RxSwift's ifEmpty(switchTo:), and there appeared to be a solution in rxswift-to-combine-cheatsheet, but current versions of Combine do not offer replaceEmpty(with publisher: Publisher). I'm thinking something like the below would work, but what do you think? If it's okay, I'll go ahead and make a pull request.
publicextensionPublisherwhere Output:Collection{func replaceEmpty(with publisher:AnyPublisher<Output,Failure>)->AnyPublisher<Output,Failure>{flatMap{(output:Output)->AnyPublisher<Output,Failure>in
if output.isEmpty {return publisher }returnJust(output).setFailureType(to:Failure.self).eraseToAnyPublisher()}.eraseToAnyPublisher()}}
The text was updated successfully, but these errors were encountered:
I was looking at for something like RxSwift's
ifEmpty(switchTo:)
, and there appeared to be a solution inrxswift-to-combine-cheatsheet, but current versions of Combine do not offer
replaceEmpty(with publisher: Publisher)
. I'm thinking something like the below would work, but what do you think? If it's okay, I'll go ahead and make a pull request.The text was updated successfully, but these errors were encountered: