Skip to content

Instantly share code, notes, and snippets.

@BetterProgramming
Created July 15, 2019 11:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BetterProgramming/d23744763a91f833b11763f32e43c728 to your computer and use it in GitHub Desktop.
Save BetterProgramming/d23744763a91f833b11763f32e43c728 to your computer and use it in GitHub Desktop.
let myDynamicColor = UIColor { (traitCollection: UITraitCollection) -> UIColor in
if traitCollection.userInterfaceStyle == .dark {
return UIColor(red: 0, green: 0, blue: 0, alpha: 1.0)
} else {
return UIColor(red: 220, green: 220, blue: 220, alpha: 1.0)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment