0

Im working on an iOS project which has multiple targets.

We have an global asset named Images.assets within a folder GlobalResources and all the targets in that projects are selected. (ie., This particular image asset is been included to all the targets).

Also i have an local Images.assets on the local target of different folder (ie., for example let my target name be iKarthickDairy)

now my target has two Images.assets. I have an image asset added to both the Images.assets with the name home_icon but the images are different. Still i could get to see only the image which is in Images.assets of GlobalResource instead of image on the Images.assets of local target.

How can I get to see the image on local target instead of the one in Global Resource, without removing the local target on the Images.assets of GlobalResource?

Note : This project has both the swift and objective-c files.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
  • change the name of the image and where it is being set? that way you can keep both the targets selected but the name that the image is set with is different – Anjula Serasinghe Nov 20 '19 at 16:47

1 Answers1

1

You cannot prioritize between asset catalogs in the same namespace. It is a big mistake to have two asset catalogs containing an image under the same name, because the order in which the asset catalogs will be searched, and hence which image will be used, is undefined.

Either use different image names, or differentiate one of the images by keeping it in a named "folder" in the asset catalog, or use different namespaces (e.g. named bundles such as frameworks) and be specific about the namespace.

matt
  • 515,959
  • 87
  • 875
  • 1,141