I don't think the enum + dictionary gets you anything on top of using a tuple:
let _PALETTE_EMOJI = (
blue: SKColor(red: 0.29, green: 0.47, blue: 0.647, alpha: 1.0),
white: SKColor(red: 0.98, green: 0.98, blue: 1.0, alpha: 1.0)
)
EDIT: THIS IS INCORRECT because UIColor is "immutable", in that it has no mutating accessors, so you'd never be able to change it anyway. I'm leaving this idea here so that you can learn that you were also wrong if you had the same idea I did.
However, SKColor is UIColor, which is a class, which is not appropriate for color usage. Until Sprite Kit has transitioned to SIMD types, you should probably return new instances every time.
struct PALETTE_EMOJI {
static var blue: SKColor {
return SKColor(red: 0.29, green: 0.47, blue: 0.647, alpha: 1.0)
}
static var white: SKColor {
return SKColor(red: 0.98, green: 0.98, blue: 1.0, alpha: 1.0)
}
private init() {}
}
As this is a frequently-used data structure, I think Emoji is more appropriate than English, but this forum can't display emoji.
I also think we can expect the next version of Xcode proper to do away with colors represented by numbers in code. Instead, we'll have editable swatches, as are used in the Unity Editor (but not its accompaying C#). Playgrounds almost have this already.