How do set you set colors with swift | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How do set you set colors with swift

Colors

11th Sep 2016, 8:15 PM
Habtamu Epley
Habtamu Epley  - avatar
2 Answers
+ 1
Import UIKit Let blackColor = UIColor.blackColor //swift v3. blackColor() for previous swift version
18th Sep 2016, 11:15 AM
swifty
+ 1
If you want to set custom color, then let myColor = UIColor(red: 75/255.0, green: 100/255.0, blue: 200/255.0, alpha: 1) will become handy. * 'alpha' value ranges between 0 & 1 setting the transparency level of the color. * If red,green & blue values are set to 0, its the black color itself.
21st Dec 2016, 6:23 AM
Alen Alexander
Alen Alexander - avatar