For iOS 13, you can use this property to check if current style is dark mode or not:
if #available(iOS 13.0, *) {
if UITraitCollection.current.userInterfaceStyle == .dark {
print("Dark mode")
}
else {
print("Light mode")
}
}
More Related Contents:
- Is it possible to opt-out of dark mode on iOS 13?
- Presenting modal in iOS 13 fullscreen
- Detecting sheet was dismissed on iOS 13
- Method ‘application:openURL:options:’ is not called
- In iOS13 the status bar background colour is different from the navigation bar in large text mode
- didRegisterForRemoteNotificationsWithDeviceToken not called in ios8, but didRegister…Settings is
- Disable gesture to pull down form/page sheet modal presentation
- How to change the status bar background color and text color on iOS 13?
- iOS 13: Swift – ‘Set application root view controller programmatically’ does not work
- SwiftUI @Binding Initialize
- iOS 13.1 Crash in AVAudio Player
- How to change the colors of a segment in a UISegmentedControl in iOS 13?
- Implement dark mode switch in SwiftUI App
- SwiftUI withAnimation completion callback
- @Published property wrapper not working on subclass of ObservableObject
- SwiftUI 2.0 List with children – how to make the tappable area of the disclosure button cover the whole list item
- UICollectionView and SwiftUI?
- iOS 13 UIBarButtonItem not clickable and overlapping UINavigationBars when using UISearchController
- iOS13 share sheet: how to set preview thumbnail when sharing UIImage
- Black screen after adding SceneDelegate and updating Info.plist
- Why I get the console warning: [Process] kill() returned unexpected error 1 when I load a WKWebView in iOS13.2?
- Fatal error: use of unimplemented initializer ‘init(coder:)’ for class
- Execute action when back bar button of UINavigationController is pressed
- String replacement in Objective-C
- How to add objects to a UIScrollView that extend beyond UIView from Storyboard?
- Create PDF with multiple pages
- how to call presentViewController from within a UICollectionViewCell
- Automatically adjustable view height based on text height in SwiftUI
- Tap on a part of text of UILabel
- Rotate UIView around its center keeping its size