Created
February 16, 2020 01:23
-
-
Save stleamist/3b1b1c78e7fc9977d6dc34c82d00977e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| extension UIColor { | |
| static func dynamicColor(light: UIColor, dark: UIColor) -> UIColor { | |
| return UIColor { (traitCollection) -> UIColor in | |
| if traitCollection.userInterfaceStyle != .dark { | |
| return light | |
| } else { | |
| return dark | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment