iosxcodeinterface-builder

Add a custom color palette to Xcode Interface Builder


My current long term project utilizes a palette of custom colors. In code, we are using a category to access these colors by name. This works great but there are times, such as when building a nib, that these colors won't be set programmatically.

I am looking for a way to define a named set of colors. For instance, when setting a background color for a UIView, I would like my drop list in Interface Builder to list my custom colors by name. Does anyone know of a way to achieve this?


Solution

  • Yes, you can create and edit a palette in IB and then share it with your team This article has all the details: https://web.archive.org/web/20210303015055/http://natashatherobot.com/xcode-color-palette/

    But, using named colors in the asset catalog is a better way to go now.