UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

Milestone: Project 4-6 basic logic

Forums > 100 Days of SwiftUI

Hi everyone, i have a problem with this milestone, i don't have any idea how to do this -> You should generate all your questions as soon as your game starts, storing them as an array of questions. Those questions should probably be their own Swift struct, Question, storing the text and the answer. Could you help me to start write this code?

2      

Hey, sorry it took so long to get to this.

So a simple struct would have the first number, the second number, and the answer, all of which would be ints.

You can't really generate them until the user's picked the range of what they want a quiz on. So when they press that button, you'd generate the answers at that point.

If you look at projects 4-6, all the building blocks are there. I just don't want to give you too much of the answer as the struggle's what helps us remember later on.

2      

Hacking with Swift is sponsored by Essential Developer

SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until April 28th.

Click to save your free spot now

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

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.