Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Asset Catalog named colors are not available to @IBInspectable properties

For my iPad app that I'm creating, I have an Asset Catalog in my project containing several color sets. I know that I can drag and drop these into the code itself and have done so for the default color of an @IBInspectable class property. However, when I go to use these in Interface Builder, my color sets are available to properties like a UIView's background color, but they're not available to any @IBInspectable property that allows users to set a color. Is there any way to expose my color sets to my @IBInspectable class to where they're selectable in Interface Builder? Sure, I can always set these programmatically, but for future use and convenience's sake, I'd like to get this working if Apple currently supports it. My Colors Asset Catalog is definitely added to my project's Bundle Resources in my Build Settings if that information is relevant.

Screenshots of my issue:

This first image shows where my color sets are selectable for properties like a UIView's background. The next two show where they're not available to my @IBInspectable properties.

Color sets selectable for UIView Background

Color set appears as missing to @IBInspectable property

Color sets not selectable for @IBInspectable property

like image 798
H. E. Becton Avatar asked Nov 03 '17 15:11

H. E. Becton


1 Answers

I've found temporary solution till the Xcode resolve this issue.enter image description here

Please use Recently Used Colors, and if you choose the one that is in your assets (in recent onces) it will automatically change it to the defined one. Works for me :) enter image description here

like image 86
Łukasz Szpyrka Avatar answered Nov 20 '22 14:11

Łukasz Szpyrka