-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Alternative to CurrentValueSubject in ViewStore
#755
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alternative to CurrentValueSubject in ViewStore
#755
Conversation
|
@iampatbrown Thanks for the PR! @mbrandonw and I just chatted about it and think it's a simple enough addition that we think it's worth merging, especially if it makes things a bit more deterministic than the tools Apple ships. The existing benchmarks (simple as they are) don't appear to be negatively affected. We also think that thread safety is probably not necessary due to the fact that it is only used in the store, which is already designed to not be thread safe. If you think this is ready, please feel free to remove the draft status and we'll look to merge! |
I thought this might have been the case as well. My main concern was if people were using Any preference on the file structure and naming? |
|
Ha didn't mean to leave you hanging here!
Nope! What you have looks great. If you think this is ready, please move it into review and we'll get it merged 😄 |
|
@stephencelis Hahaha. No worries. Did you give it a test drive? Pretty sure it was all good when we originally looked at it. |
|
@iampatbrown Yup! All looked good to us and seems to benchmark about the same 😄 |
* Replaced CurrentValueSubject with CurrentValueRelay * Added final to DemandBuffer Co-authored-by: Brandon Williams <mbrandonw@hey.com>
* Perform thread check only when store is created on main thread. * clean up * Update Sources/ComposableArchitecture/Store.swift * clean up * Update Sources/ComposableArchitecture/Store.swift * clean up * execute setSpecific only once. * logic fix * added a test * typo * wip * docs * fix test * Update Sources/ComposableArchitecture/Store.swift Co-authored-by: Thomas Grapperon <35562418+tgrapperon@users.noreply.github.com> * Run swift-format * Clean up speech recognition case study. (#812) * Clean up speech recognition case study. * fix tests * clean up; * Alternative to `CurrentValueSubject` in `ViewStore` (#755) * Replaced CurrentValueSubject with CurrentValueRelay * Added final to DemandBuffer Co-authored-by: Brandon Williams <mbrandonw@hey.com> * Run swift-format * Fix bindable deprecations (#815) * Fix Bindable Deprecations * More CI * wip * wip * wip * wip * Run swift-format * beef up test * expectation * fix Co-authored-by: Stephen Celis <stephen@stephencelis.com> Co-authored-by: Thomas Grapperon <35562418+tgrapperon@users.noreply.github.com> Co-authored-by: stephencelis <stephencelis@users.noreply.github.com> Co-authored-by: iampatbrown <mrpatbrown@gmail.com> Co-authored-by: mbrandonw <mbrandonw@users.noreply.github.com>
This is a proof of concept as a way to provide consistent ordering for StorePublisher subscribers (discussed in #698). @mbrandonw mentioned:
so I thought I'd give it a try. Pretty sure it will need to be made thread safe and have some extensive tests/benchmarks added.
I can see the benefits of sticking with CurrentValueSubject and I haven't thoroughly tested this... just checking to see if it's something worth exploring further. I used CombineExt/CurrentValueRelay as a starting point.