I want to persist the preferences user selected via AppStorage, however if I change the @State to @AppStorage, the UI will stuck after the toggling.
To reproduce the problem, change the isOn1 in AccountsScreen to :
struct AccountsScreen: View {
@AppStorage("isOn1") private var isOn1 = true
....
}
then start the application, the first time toggle the "Permissions" is ok, but if trying to toggle it the second time, it just won't work and the toggle of "Permission" is stuck.
I want to persist the preferences user selected via AppStorage, however if I change the
@Stateto@AppStorage, the UI will stuck after the toggling.To reproduce the problem, change the
isOn1inAccountsScreento :then start the application, the first time toggle the "Permissions" is ok, but if trying to toggle it the second time, it just won't work and the toggle of "Permission" is stuck.