in my project I'm having an array of colors. Should I use UIColor as the underlying type or cgColor?
Are there any best practices?
On
CGColor is used to apply color operations with Core Graphics contexts like CGImage, CGLayer etc...cgColor: An instance property of UIColor, relates UIColor and CGColor with each other.
Note: You can store reference to anyone but you must convert them into a relevant color class while dealing with color operations on graphical interface elements, to which it belongs.
Use UIColor and if you want to convert it anyTime
UIColor: Usual we use as background colour of views
cgColor: always used for layers (as fill or stroke) or borders of views