make preivew in dark mode swiftui
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView().preferredColorScheme(.dark)
}
}
make preivew in dark mode swiftui
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView().preferredColorScheme(.dark)
}
}
dark mode change immediately swift
guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else {
return
}
appDelegate.changeTheme(themeVal)
// App Delegate Change Theme method
func changeTheme(themeVal: String) {
if #available(iOS 13.0, *) {
switch themeVal {
case "dark":
window?.overrideUserInterfaceStyle = .dark
break
case "light":
window?.overrideUserInterfaceStyle = .light
break
default:
window?.overrideUserInterfaceStyle = .unspecified
}
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us