TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

(Challenge 1 for projects 1-3) Is there a way?

Forums > 100 Days of Swift

I want to put the flag images in the Assets Catalog and then read their names out at run time.

Is there a way to get a list of assets? I think there is not.

I think I am going to rename the 3x images to, say, "Estonia.jpg" and putting them in a folder as we did with StormViewer.

I wish there were a fancier solution.

3      

No but in Xcode 15 (beta) you can use do

static let allCountries: [ImageResource] = [.estonia, .france, .germany, .ireland, .italy, .nigeria, .poland, .russia, .spain, .UK, .US]

You might have to change a few other codes to make it work!

4      

That's nifty, but doesn't solve the problem of loading an unknown set of countries.

3      

Hacking with Swift is sponsored by Superwall.

SPONSORED Superwall lets you build & test paywalls without shipping updates. Run experiments, offer sales, segment users, update locked features and more at the click of button. Best part? It's FREE for up to 250 conversions / mo and the Superwall team builds out 100% custom paywalls – free of charge.

Learn More

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.