Post

Replies

Boosts

Views

Activity

Reply to SwiftUI view state resetting after alert is shown
Thanks for chiming in @lucasgladding! The package dependency is actually the code that we are working on. We want the integration point to be simple within the apps that uses our package. It's true that moving the sheet up in the view layout does correct the behavior but that complicates the app side integration. Since it seems to be new behavior, and currently only reproducible on certain simulators, it feels like a bug. A feedback request (FB21697975) was submitted through Feedback Assistant to Apple. In our use case, the alert is a sign out confirmation alert, so having it auto dismiss creates a bad user experience and would be problematic if it started happening on devices
Topic: UI Frameworks SubTopic: SwiftUI
4d
Reply to SwiftUI view state resetting after alert is shown
Thanks for the help on this! Xcode Version 26.2 (17C52), issue seen on iPhone 17, iOS 26.2 simulator. presentedCount was added to highlight the issue, but main concern is that the alert automatically dismisses the first time it is shown (it's hard to tell in the video, so presentedCount was added to make it more visually apparent). Changing the ViewWithAlert properties to Binding doesn't seem to fix the alert dismissal issue. Sample Xcode project: https://drive.google.com/file/d/10S5_xdl_RZeUVSlqfCrgzIGeBFjLjRyb/view?usp=sharing
Topic: UI Frameworks SubTopic: SwiftUI
1w
Reply to SwiftUI view state resetting after alert is shown
Tested on iPhone 14 Pro and iPhone 17 physical devices running iOS 26.2, both keep state intact and correctly increment with each display of the alert. Most teammates and myself see the loss of state behavior only on iPhone 17 (iOS 26.2) simulator and not other 17 variants or older sims. The desire of LibraryView, inside a Swift package linked as a dependency, is to show a sheet when tapped without concern about how the app is using it within its view layout (ContentView in the example). Another example could be a package that has a public AccountView that when tapped shows a private account settings view. Allowing app to display the AccountView where they want without having to know internals for displaying the settings view.
Topic: UI Frameworks SubTopic: SwiftUI
1w