I'm new to Swift and I'm having a problem with UIColors in SpriteKit. I'm declaring a set of colors in an enum like this:
enum Colors {
static let red = UIColor(red: 231/255, green: 76/255, blue: 60/255, alpha: 1)
}
Then I set a SKSpriteNode, arbitrarily called element, to that colour, like:
element.color = Colors.red
If I print the values now, this will be the result:
print(Colors.red)
UIExtendedSRGBColorSpace 0.905882 0.298039 0.235294 1
print(element.color)
UIExtendedSRGBColorSpace 0.905882 0.298039 0.235294 1
And apparently they look the same, but if I do this:
print(element.color == Colors.red)
It's going to return false
Can anyone explain to me why this is happening? Thanks in advance.