Starting from iOS/iPadOS 13, a dark user interface style is available, similar to the dark mode introduced in macOS Mojave. How can I check whether the user has enabled the system-wide dark mode?
Dark mode can be detected by using the userInterfaceStyle property on the current trait collection. When it's set to dark you know that the current appearance is set to dark.
If you have an iPhone updated to iOS 13 or an Android phone that's updated to Android 10, your device will support system-wide dark mode. However, this still only applies to supported apps. Many other apps have their own dark modes that you will need to activate individually.
On your iPhone or iPad, navigate to Settings > Display & Brightness and tap the Dark theme under Appearance.
The introduction of Dark Mode undoubtedly put a smile on the face of many Apple fans! We, iPhone, iPad, and iPod users have been begging for the feature for years! The good news for us iPhone and iPad folks is that dark mode finally made the cut in iOS 13 and iPadOS!
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") } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With