Skip to content

Instantly share code, notes, and snippets.

@AlexandrFadeev
Created February 21, 2020 10:59
Show Gist options
  • Save AlexandrFadeev/e6cd4d6a0c5d04432c529e7536b637b7 to your computer and use it in GitHub Desktop.
Save AlexandrFadeev/e6cd4d6a0c5d04432c529e7536b637b7 to your computer and use it in GitHub Desktop.
Dynamic color in code
let dynamicColor = UIColor { (traitCollection: UITraitCollection) -> UIColor in
if traitCollection.userInterfaceStyle == .dark {
return .black
} else {
return .white
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment