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

Add deprecations to non-view WithViewStore initializers #1323

Merged
merged 13 commits into from
Sep 1, 2022

Conversation

stephencelis
Copy link
Member

We've found that WithViewStores overloads can really tax the compiler, so it's time to get prepare to remove them. The vast majority of uses are in SwiftUI views, so we can privilege the helper for that use case, and require a bit of extra work of manually observing a view store via @ObservedObject in the other cases.

In the future it would be nice to deprecate WithViewStore entirely, but we would want to offer a simpler tool, e.g. a property wrapper called @ObservedStore that smashes the concepts of Store and ViewStore together without a lot of boilerplate. This would lessen compiler strain by avoiding escaping closures and generic transforms in the view builder layer. Unfortunately, we still haven't figured out how to get property wrappers to work in a way that we find simple and intuitive.

In the meantime we can hopefully improve performance of the tool we provide by narrowing its focus to the most common builder.

@tgrapperon
Copy link
Contributor

There are some tests in WithViewStoreAppTest that may already be removed I guess. There were only assessing that the overloads were effective.

@stephencelis stephencelis merged commit a6fc9a2 into main Sep 1, 2022
@stephencelis stephencelis deleted the with-view-store-deprecations branch September 1, 2022 16:45
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.

3 participants