I have an app where I would like to add many images (500+) to xcode's asset catalog. Adding the 1x images was easy, I simply had to drag the first folder. However to add the 2x and 3x images it seems I would need to drag each image in manually, and I'd prefer not to do that. The 3 different sizes for each image are all named the same, w/ just different sizes. Is there anyway to automate this process?
You can named image something like : yourimg.png, [email protected], [email protected]
,so it's become one set. Let's take another : dogImg.png, [email protected], [email protected]
then this is second set.
So, you can name images like this and put every images to one single folder.
Then you simply drag and drop that folder to xcode, and you have done!
No need to use assets in this case! this naming conversion manage same as assetts
.!
Refer Raywebderlich's one tutorial's portion where they are adding images like this.
OR (recommended way - because it is using assets)
Name your images like - [email protected], [email protected], [email protected]
and drag all them in to the assets and it will automatically take place at proper location. That's it!!
You can maintain folder structure also. For example If you have folder structure like below screen shot,
and If you drag and drop whole Images
folder to assets then xcode
will manage everything for you(see result in below screenshot) but you just need to keep in mind that follow the naming standard for the images like [email protected], [email protected], [email protected]
. You can ignore @
for 1x
image, I mean your image set can be like test.png, [email protected], [email protected]
also!
Screenshot of assets
after dragging Images
from the finder,
Happyxcasset
is a python script that easily imports resource files into xcassets in Xcode.
https://github.com/qdvictory/happyxcasset
You will like it.
© 2022 - 2024 — McMap. All rights reserved.