Open wyhaya opened 2 years ago
Hi, I read your article, I am a swift newbie and I don't know if this is valuable, but it works well
@main struct YourApp: App { @AppStorage(appearanceName) var appearance = Appearance.system var body: some Scene { WindowGroup { ContentView() .preferredColorScheme( appearance == Appearance.dark ? .dark : appearance == Appearance.light ? .light : .init(UIUserInterfaceStyle.unspecified) ) } } }
@AppStorage(appearanceName) var appearance = Appearance.system Picker("Appearance", selection: $appearance) { Text("System").tag(Appearance.system) Text("Light").tag(Appearance.light) Text("Dark").tag(Appearance.dark) }
Thanks for taking time to comment. I'll check and update the repo with latest details.
Hi, I read your article, I am a swift newbie and I don't know if this is valuable, but it works well