-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
[ADD] refined combine API #38
[ADD] refined combine API #38
Conversation
Thanks @JonnyBeeGod! Overall this looks good. 💯 My only hesitation is bumping the minimum deployment targets, which will require a major version update (to 3.0), but maybe that's not terrible since clients can just use the 2.0 version indefinitely... |
That's great to hear! I updated the PR with your comments, the only thing left would be the example project where I am uncertain on how to proceed. The current example on main branch does not use combine, we could either rewrite it or extend my quickly thrown together Combine example (and maybe also showcase SwiftUI integration). What do you think? |
Thank you! 🙌🏼 Everything is looking good to me. 😎
I'll try to checkout your branch and take a look, then decide. Overall, I think this is mostly ready to go, but I've only done a quick review -- I'll take a closer look soon. I'm a bit busy with the holidays and such -- but I really appreciate this contribution! 😊 |
If Foil changes to vend a publisher via I'm not sure how to construct a correctly-typed Otherwise, the currently suggested |
Thanks for the feedback @nolanw! I'm not entirely sure I'm following here. @JonnyBeeGod can you help? Also, I'm hoping I can circle back to this by the end of this week and get this change landed. 😄 |
I kinda went off into the weeds there. More concisely: The current implementation in this PR adds a It's certainly not worth holding up this PR, just an idea to ponder. Since the projected value is an AnyPublisher, we can always change it later. If I give my idea a try, I'll open a new PR. Sorry for hijacking this one! |
@nolanw ah, I see what you mean. 💯 Yes, to accommodate the scenario you describe, you would need a centralized mechanism to access all user defaults. I believe our suggested usage for This PR is essentially just simplifying the existing pattern by allowing you to omit the call to But, in any case, yes -- feel free to open a new issue to discuss further! 😊 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright @JonnyBeeGod -- I just pushed a few minor changes. This is ready to go 💯
I'll set it to merge automatically and I'll work on releasing 3.0 by next week.
Hm. I think the test failures are flakes. I will address them in #39 before tagging the new release. |
@JonnyBeeGod I've also invited you to be a collaborator on this project. 😄 |
Hey thank you very much :) The invitation already expired but I would still very much like to be a contributor. |
@JonnyBeeGod -- resent! |
Have you read the Contributing Guidelines?
Issue # (no issue yet, can be created if needed)
Describe your changes
This PR removes the need for the
.publisher(for:)
KVO API call, theNSObject
inheritance and the@objc dynamic
annotations by making use of theprojectedValue
property of the property wrappers. See https://www.avanderlee.com/swift/property-wrappers/#projecting-a-value-from-a-property-wrapper for more details on this topic. Please note that I like to useCurrentValueSubject
instead ofPassthroughSubject
as this makes sure our publisher is stateful and immediately publishes the currently saved value on sink. If we would usePassthroughSubject
instead,receiveValue
would only fire after the value has been updated again.This is only a draft PR as this makes discussion way easier rather than describing this change in an issue. Also the example view needs more works and was just thrown together quickly to be able to test the combine API without interference of the manually triggered
tableView.reloadRows
calls after each update of the values.Also note the updated deployment targets. This would be required in order to be able to use the Combine publishers
Please let me know what you think