|
How do I get the RGB color values so I can display them under each color swatch when I am creating random colors? This.. How to read the red, green, blue, and alpha color components from a UIColor ...shows how to get the values for one UIColor,
but I'm making two and changing them to random colors when clicking a button.
That gets error "Cannot find 'blue' in scope" When I try to add the variables as CGFloats, I get 4 different errors. |
|
Something like this will work:
|
|
Maybe as an alternative you could create something like This way you have this information neatly encapsulated and gives you more freedom. |
SPONSORED From March 20th to 26th, you can join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills β itβs the fast track to being a complete senior developer!
Sponsor Hacking with Swift and reach the world's largest Swift community!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.