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

Fix AlertState.init availability #198

Merged
merged 2 commits into from
Aug 12, 2024
Merged

Fix AlertState.init availability #198

merged 2 commits into from
Aug 12, 2024

Conversation

stephencelis
Copy link
Member

In SwiftUI Navigation 1.0, AlertState had many initializers to match the various interfaces in SwiftUI, and they matched the availability of the SwiftUI interfaces. We simplified to a single interface in 2.0, but didn't consider the availability mismatch.

While we could bring back the old APIs, it might be nice to favor the modern builder style. The one caveat is that it will be possible to render alerts pre-iOS 15 that are configured with more than the maximum 2 buttons at that time. We can emit a runtime warning if we detect this, but we are losing some of the compile-time check of the previous version.

In SwiftUI Navigation 1.0, `AlertState` had many initializers to match
the various interfaces in SwiftUI, and they matched the availability of
the SwiftUI interfaces. We simplified to a single interface in 2.0, but
didn't consider the availability mismatch.

While we could bring back the old APIs, it might be nice to favor the
modern builder style. The one caveat is that it will be possible to
render alerts pre-iOS 15 that are configured with more than the maximum
2 buttons at that time. We can emit a runtime warning if we detect this,
but we are losing some of the compile-time check of the previous
version.
@stephencelis stephencelis requested a review from mbrandonw August 11, 2024 23:20
@stephencelis stephencelis merged commit 47cfd14 into main Aug 12, 2024
1 check passed
@stephencelis stephencelis deleted the fix-alert-state-init branch August 12, 2024 15:25
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