BLACK FRIDAY: Save 50% on all my Swift books and bundles! >>

SOLVED: Project 2

Forums > 100 Days of Swift

On day 21, as a wrap up we are asked to try and show our score as well as the name of the country in the navigation bar. I have tried various methods but I havent found out how to do it, and I am also struggling with the second challenge, to track the questions that have been asked, I'm thinking maybe tracking how many times the askQuestion function has been called? I do not know how to do that.

3      

For the first one, just set the title property of your view controller. The navigation view controller will take care of showing it in the navigation bar.

As for the second one, you're right. You need to create a counter and increment it in the askQuestion() function.

5      

Yes, I know how to make the title show, like the name of the country but we are also meant to make our score show, meaning it'll be two titles, this is where I am confused.

Thank you

3      

Save 50% in my WWDC sale.

SAVE 50% All our books and bundles are half price for Black Friday, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more.

Save 50% on all our books and bundles!

No. It's a single title. You just put the country name and the score in a string and set it as the title. That's all.

title = "\(countryName) - Score: \(score)"

4      

Ah right thank you my stupid mistake

I used / instead of \

3      

Did you find solution of other exercises ?

3      

Did you find solution of other exercises ?

3      

Yes I did, do you need help?

3      

Yes i do , i cant complete 2 and 3 exercises Can you help me with that ?

3      

My pleasure, so what have you tried as a way to note the amount of times the question function has been called? I'll give you a clue, create a variable first and set it to zero, and you would like to put this variable into a certain function, and increment this variable in this function. Can you guess the function?

As for the third one, you should be working with the else, in your buttonTapped function. When the score is wrong, and put what is asked.

3      

Save 50% in my WWDC sale.

SAVE 50% All our books and bundles are half price for Black Friday, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more.

Save 50% on all our books and bundles!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

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.