Skip to content
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

[PROPOSAL] Implement Observable through swift-perception #69

Closed
wants to merge 0 commits into from

Conversation

grdsdev
Copy link

@grdsdev grdsdev commented Jun 7, 2024

Changes

Close #54

Hi, this is a proposal of implementing Observable support, but using the https://github.com/pointfreeco/swift-perception library from Point-Free for making it available on iOS 13+

I just commented out some code that I don't think is needed anymore, such as the Stored property wrapper.

@mergesort if you think this is the way to go, I can keep working on this PR to get it to a mergeable state.

@mergesort
Copy link
Owner

Hey @grdsdev, thank you for the hard work and the proactive pull request. There are a couple of reasons I don't plan on merging this in, but I want to say that I really appreciate the idea!

  1. The main reason there hasn't been an Observable-based refactor of Boutique until now is because I've been waiting for this summer for Swift 6 and Swift's concurrency model changes to settle down. I'm not only going to update the API to use Observable, but I also plan on making sure that everything is properly thread safe, given how important data races are to a framework like Boutique.
  2. Your pull request focuses on migrating the Store to Observable, but that's actually the easy part. Unfortunately Observable and property wrappers don't play well together, which is perfectly fine in the Store, but it doesn't work for StoredValue, SecurelyStoredValue, and AsyncStoredValue. I'm going to have to migrate those over to macros, which has it's own set of tradeoffs, but I'm working on that to see if it's something feasible for Boutique.
  3. I've been using this as an opportunity to rethink the fundamentals of what's necessary, and what breaking changes I plan to make in Boutique 3.0. Besides removing deprecated APIs I've been considering removing the aforementioned AsyncStoredValue, because it doesn't really serve much of a purpose since I ended up building StoredValue and SecurelyStoredValue. I may also introduce a new KeyBackedStoredValue, which will be the foundation for StoredValue and SecurelyStoredValue, all of which (and more) is already a work in progress.
  4. I don’t have plans on integrating Perceptible, because I don't have any plans on backporting this all the way to iOS 13. There are a couple of reasons for this, one is part of my plan remove Combine to allow Boutique and Bodega to run cross-platform. This means I need some sort of replacement for streaming values over time, in this case AsyncStream is that solution, which is only supported in iOS 17/macOS 14+. I figure this is a good baseline given iOS 18 will be out soon, will allow me to create APIs that work on Linux, with older versions still supported with the Boutique 2.x series.

I have a Boutique 3.0 beta running locally and plan to push it up in the next week or two, it won't be complete but it'll be a start that looks similar in some ways to your work.

Hope that makes sense, I'm happy to answer any questions you may have!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement @Observable on iOS 17/macOS 14
2 participants