Skip to content

Instantly share code, notes, and snippets.

@BetterProgramming
Created July 15, 2019 11:52
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/a3a5f4b261aee2667aacdc0bae9adb98 to your computer and use it in GitHub Desktop.
Save BetterProgramming/a3a5f4b261aee2667aacdc0bae9adb98 to your computer and use it in GitHub Desktop.
func createTitleColor(lightVersion : UIColor, darkVersion : UIColor)->UIColor {
if #available(iOS 13.0, *) {
let myDynamicColor = UIColor { (traitCollection: UITraitCollection) -> UIColor in if traitCollection.userInterfaceStyle == .dark {
return darkVersion
} else {
return lightVersion
}
}
return myDynamicColor
} else {
return lightVersion
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment