Skip to content

Latest commit

 

History

History
16 lines (13 loc) · 673 Bytes

File metadata and controls

16 lines (13 loc) · 673 Bytes

Dark mode - iOS

On iOS, you can detect dark mode by checking if the userInterfaceStyle has been set to .dark.

You can provide dark mode resources to let iOS automatically use the right resources. For example, inside Assets.xcassets you can add a Dark version for colors and images.

func isInDarkMode() -> Bool{
    if #available(iOS 12.0, *) {
        if UIScreen.main.traitCollection.userInterfaceStyle == .dark {
            return true
        }
    }
    return false
}