Skip to content

Persist state via AppStorage #98

@alaneuler

Description

@alaneuler

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions