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

Promote Void? bindings to Bool via dynamic member lookup #274

Merged
merged 2 commits into from
Feb 20, 2025

Conversation

stephencelis
Copy link
Member

We have an explicit initializer for this conversion, but it's not super discoverable and it's generalized to all optionals. We can make a shorthand for Void payloads, which simplifies presentation:

-.sheet(isPresented: Binding($destination.sheet)) {
+.sheet(isPresented: $destination.sheet) {
   // ...
 }

Other changes:

  • SwiftUI.Binding<Bool>(Binding<Optional>)'s implementation strayed slightly from UIKit's UIBinding implementation, where issues were not reported. This is fixed.

  • Added missing documentation.

We have an explicit initializer for this conversion, but it's not super
discoverable and it's generalized to all optionals. We can make a
shorthand for `Void` payloads, which simplifies presentation:

```diff
-.sheet(isPresented: Binding($destination.sheet)) {
+.sheet(isPresented: $destination.sheet) {
   // ...
 }
```

Other changes:

- `SwiftUI.Binding<Bool>(Binding<Optional>)`'s implementation strayed
  slightly from UIKit's `UIBinding` implementation, where issues were
  not reported. This is fixed.

- Added missing documentation.
@mbrandonw mbrandonw merged commit 116496f into main Feb 20, 2025
3 of 8 checks passed
@mbrandonw mbrandonw deleted the binding-updates branch February 20, 2025 01:12
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