I usually use custom UIColors on iOS using extensions with Swift, but now with iOS 11/ Xcode 9 we can create Colors Sets. How can we use them?
Update - Tip>
Add a colour set to an asset catalog, name it and set your colour in the attributes inspector, then call it in your code with UIColor(named: "MyColor")
.
In the asset catalog viewer, click the plus button at the bottom right of the main panel and choose New Color Set
Click on the white square, and select the Attributes Inspector (right-most icon in the right pane)
From there you can name and choose your colour.
To use it in your code, call it with UIColor(named: "MyColor")
. This returns an optional, so you'll need to unwrap it in most cases (this is probably one of the few cases where a force unwrap is acceptable, given you know the colour exists in your asset catalog).