As Combine and SwiftUI both mature, projects that want to embrace these frameworks may need to bridge between RxSwift Observables and Combine Publishers. This repository adds such a bridge by adding an asPublisher()
extension onto ObservableConvertibleType
.
- The problem: You're building a reddit client that shows a feed of /r/pics posts, and you have an
postsObservable
RxObservable of typeObservable<[RedditPost]>
- you have a SwiftUI component
SubredditView(redditFeed:)
whereredditFeed
is expected to be a Combine Publisher - you can now create your component using
SubredditView(redditFeed: postsObservable.asPublisher())
NOTE: Source code for this project lives in the Shared/
folder.