Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get all image names in asset catalog group?

Tags:

ios

swift

In my app I had a folder of images from which I was getting the names to use as keys to a Dictionary. I have now moved all images to an asset catalog and created groups for the relevant folders. The code using FileManager is not working anymore as it can not find any folders (due to the assets being compiled into a .car file).

How should I approach this?

like image 888
Dionysis Avatar asked Jan 12 '15 13:01

Dionysis


1 Answers

So (following matt's suggestion) here is what I did:

I created a RunScript build phase to run before compiling

enter image description here

and used a script to create a txt file with the names of the files that I can then use during runtime

#!/bin/sh
>./your_app_folder/fileNames.txt
for FILE in ./your_app_folder/Images.xcassets/actions/*; do
echo $FILE >> ./your_app_folder/fileNames.txt
done
like image 158
Dionysis Avatar answered Oct 17 '22 17:10

Dionysis