Reputation:
I tried toggle the dark mode, I know Swift 4 or 5 I use the code:
overrideUserInterfaceStyle = .dark
But in SwiftUI, seem nothing way I can do that...how can I toggle the dark mode rest of app? I tried do many method and search everywhere but couldn't find any luck. Even I tried use didSet but no luck, it give me the error.
Any suggestion?
Upvotes: 4
Views: 3414
Reputation: 119
If you want to force dark mode for the whole app you can add the User Interface Style
to the Info.plist
and set it to Dark
You can also add the following line to the Scene/App Delegate
window?.overrideUserInterfaceStyle = .dark
Upvotes: 5