How to create Named colors in Interface Builder?

Solutions Collect From Internet About “How to create Named colors in Interface Builder?”

In Xcode9 you can add “New Color Set” to .xcassets files, where you can set rgba values or use IB’s color picker.

Add new Color set to Assets.xcassets in Xcode 9

Then you can use that newly defined color from Interface Builder’s color picker, it appears under the Named Colors section.

yourCustomColor appears in IB's color picker, under Named colors section

Or you can use it from code like UIColor(named:"customColorName").

As for now, Xcode9 beta 1 does not support using string literal color names as UIColor (like it works with UIImages), but I hope it will work in a later release.

Unfortunatelly it’s only available for iOS11 and later.
enter image description here