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

SOLVED: Day 22 bug/feature (?) with country names

Forums > 100 Days of SwiftUI

Hello everyone,

I have ben going through the course and faced something in Day 22 I could not understand.

The original code had a line:

@State private var countries = ["Estonia", "France", "Germany", "Ireland", "Italy", "Nigeria", "Poland", "Russia", "Spain", "UK", "US"].shuffled()

I tried to modify it a bit to make the names proper:

@State private var countries = ["Estonia", "France", "Germany", "Ireland", "Italy", "Nigeria", "Poland", "Russia", "Spain", "The UK", "The US"].shuffled()

Basically, changing "US" to "the US" and "UK" to "the UK". When I did that, I noticed that flag of the US and the UK stopped showing up, even though they were still in the game. Even more, the app asked about them: Screenshot 1 Screenshot 2

It works just fine with the original array.

Did I miss anything in the videos? Why does it render the app the way it does?

3      

In Assets Catalog you added files with the names of countries. Right? If you have a file with the name of "US" and trying to get the picture with "The US" which does not exist in your catalog. XCode cannot predict the name of your files without providing correct spelling.

3      

Owww, I did not even think about that! Thank you for the clarification, @ygeras!

3      

Hacking with Swift is sponsored by String Catalog.

SPONSORED Get accurate app localizations in minutes using AI. Choose your languages & receive translations for 40+ markets!

Localize My App

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.