GenerateAssetSymbols wrongly renaming image assets

Xcode generates symbols for image and color assets now (which is super nice!). We noticed an issue when generating code symbols for our image assets. We have an image named inputContour and one named inputContourColor. Xcode was not able to generate a symbol for inputContourColor and instead produced the following warning:

#warning("The \"inputContourColor\" image asset name resolves to the symbol \"inputContour\" which already exists. Try renaming the asset.")

It turns out that the generator automatically removes the color suffix when creating the code symbol. For color assets, this probably make sense (so tealColor would become just teal), but this should not be applied to image resources.

  • Filed as FB12901757. Thanks for looking into this!

Add a Comment

Replies

I'm running into the same issue. Is there a way to turn off GenerateAssetSymbols for a Swift Package, or perhaps a general idea of when this would be fixed?

Facing redeclaration issue for Assets even if I add a new Assets Catalog in XCode 15. I don't have any other Assets folder. Working fine in Xcode 14.3.1.

Hello, I have the same issue. Were you able to solve it?

Hello, I have the same issue. Were you able to solve it?

So on looking online I found: Asset symbol generation is enabled by default but can be disabled by setting the build setting “Generate Asset Symbols” ( ASSETCATALOG_COMPILER_GENERATE_ASSET_SYMBOLS ) to NO,

however I still can't find this in my build settings, I will post if I find it

Hello, if I'm not wrong, to disable "Generate Asset Symbols", go in your build setting. By default, "Basic" is selected. To show "Generate Asset Symbols", select "All". Then scroll down and in the "Asset Catalog Compiler - Options" category, you should find "Generate Asset Symbols". Turn it to NO and "Generate Asset Symbols" should be disabled.

I'm French so I'm sorry if there are mistakes in my English. I hope my message will help you. Have a nice day.

Make the following changes as shown in image and it will work

You save my day!! Thanks!!

I am having this issue as well. I have tried to turn off that setting, but it does not work. Our asset catalog is in a Swift Package.

I tried this in the package file, but it also doesn't work. It actually says that conditional statements like this don't have values. So I take that to mean that the absence of this flag would indicate that it is a NO. But that doesn't seem to be the case.

swiftSettings: [
    .define("ASSETCATALOG_COMPILER_GENERATE_ASSET_SYMBOLS=NO"),
]

Am I trying to configure this wrong for the Swift Package? 🤔