Skip to content

Instantly share code, notes, and snippets.

@TheWorstProgrammerEver
Last active March 11, 2022 05:47
Show Gist options
  • Save TheWorstProgrammerEver/c1894b1bb14967a104fa9cdea6eeaa9f to your computer and use it in GitHub Desktop.
Save TheWorstProgrammerEver/c1894b1bb14967a104fa9cdea6eeaa9f to your computer and use it in GitHub Desktop.
Swift custom colours based on enum example
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