Skip to content

Add UIBinding deprecation warnings to avoid misuse #284

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

Merged
merged 3 commits into from
Apr 4, 2025
Merged

Conversation

stephencelis
Copy link
Member

The @UIBinding property wrapper is meant as a substitute for @State, where you can introduce local, owned state to a view controller that can be strongly held in another child, but because it is completely unconstrained it was easy to reach for instead of @UIBindable when it came to view models, and those view models could be retained too strongly.

This PR introduces a couple deprecated overloads to catch this misuse and guide folks towards @UIBindable, instead.

We might want to consider this subtlety a bit more and rethink or better document the differences.

Addresses #283.

The `@UIBinding` property wrapper is meant as a substitute for `@State`,
where you can introduce local, owned state to a view controller that can
be strongly held in another child, but because it is completely
unconstrained it was easy to reach for instead of `@UIBindable` when it
came to view models, and those view models could be retained too
strongly.

This PR introduces a couple deprecated overloads to catch this misuse
and guide folks towards `@UIBindable`, instead.

We might want to consider this subtlety a bit more and rethink or better
document the differences.
@stephencelis
Copy link
Member Author

Had to comment out another Windows CI. We can revisit if we ever get a fix here: pointfreeco/swift-issue-reporting#156

@mbrandonw mbrandonw merged commit 7e2de75 into main Apr 4, 2025
8 checks passed
@mbrandonw mbrandonw deleted the uibinding-fixes branch April 4, 2025 16:43
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.

2 participants