How in UIKit do i tell if the user is in dark mode or not
How do I check weather Im in Dark Mode or not in UIKit
Add a Comment
How in UIKit do i tell if the user is in dark mode or not
The viewcontroller has a traitCollection and you can query its userInterfaceStyle.
if traitCollection.userInterfaceStyle == .light {
//light mode
}
You can check this property:
UITraitCollection.userInterfaceStyle
For a detailed explanation: https://schiavo.me/2019/implementing-dark-mode/
The viewcontroller has a traitCollection and you can query its userInterfaceStyle.
if traitCollection.userInterfaceStyle == .light {
//light mode
}