Last active
March 11, 2022 05:47
-
-
Save TheWorstProgrammerEver/c1894b1bb14967a104fa9cdea6eeaa9f to your computer and use it in GitHub Desktop.
Swift custom colours based on enum example
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 SwiftUI | |
enum CustomColors : String { | |
case | |
listBackground, | |
iPhone13ShowcaseBackground, | |
iPhone13BoxContentBackground, | |
iPadMiniBoxContentBackground | |
// etc | |
} | |
extension CustomColors { | |
var color: Color { | |
Color(rawValue) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment