R.objc icon indicating copy to clipboard operation
R.objc copied to clipboard

Support namespaces in .xcassets

Open grzegorzkrukowski opened this issue 7 years ago • 2 comments

Hey

Currently this script is not supporting namespaces in .xcassets, would be great to have it working. Swift version handles those properly, allowing duplicated names.

grzegorzkrukowski avatar Jan 25 '18 13:01 grzegorzkrukowski

What do you mean for namespaces? Are they the groups/folders you can create in the assets to organize the images?

guidosabatini-sysdata avatar Jan 25 '18 13:01 guidosabatini-sysdata

@guidosabatini-sysdata Right now images are generated into one flat object, which creates few possible conflicts when you have same image names into your project:

  1. Having same image name as assets catalog name creates a conflict
  2. Having same image name on normal folders and inside assets catalog creates a conflict
  3. Having same image names in different namespaces in assets catalog creates a conflict, normally here it's possible to have imageNamed:@"namespace1/button" and imageNamed:@"namespace2/button".

If you compare that to R.swift in Swift - they do generate separate objects for each assets catalog or folder so you are doing R.assetscatalogname.namespace1.button for example.

grzegorzkrukowski avatar Jan 26 '18 10:01 grzegorzkrukowski