Rx (or Combine) wrapper for Sharing library #175
Unanswered
marcuswu0814
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
In my current project, many of our services expose state through Observables as their interface. As a result, I often find myself writing a lot of boilerplate code to bridge these observables into TCA bindings. Here’s a simplified example:
As the number of observables I need to listen to increases, this pattern leads to a lot of repetitive code.
To reduce this boilerplate, I tried adopting the Sharing library and created a custom key for Rx observables like this:
Now I can use it like this:
This works well so far, but I’d love to get feedback:
• Are there any trade-offs or pitfalls I should be aware of when using this approach?
• Is there a better or more idiomatic way to bridge RxSwift.Observable into Sharing?
Any insights or suggestions would be greatly appreciated. Thanks! 🙏
Beta Was this translation helpful? Give feedback.
All reactions