Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

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
     }
  }
}
Comment

PREVIOUS NEXT
Code Example
Swift :: index string swift 
Swift :: IOS create UIAlertViewController programmatically 
Swift :: swift core data sort by date 
Swift :: dismiss two view controllers at once swift 
Swift :: and in swif 
Swift :: swift change background color 
Swift :: swift order dictionary by key 
Swift :: how do i have countdown timer in swift stackoverflow 
Swift :: uiimage to data swift 
Swift :: try? as? in swiftui 
Swift :: swift completion handler 
Swift :: remove cocoapods swiftr 
Swift :: set in swift 
Swift :: add shadow to specific corner of UIView with shadow swift 6 site:stackoverflow.com 
Swift :: defer swift 
Swift :: swift struct 
Swift :: how to Not bool bindng swiftui 
Swift :: save file with % swift 
Swift :: swiftui text editor 
Swift :: swift dictionary 
Swift :: swift firebase realtime db class 
Swift :: Swift break with while Loop 
Swift :: Customize indicator view iOS swift 
Swift :: Swift enum With Switch Statement 
Swift :: Swift Iterate Over a Set 
Swift :: Swift Bitwise NOT Operator 
Swift :: SwifUI call the function in the cordinator 
Swift :: Used with Collections Swift 
Swift :: swift split an array into chunks 
Swift :: remove grey background when selecting cells from uitableview swift after selection 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =