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

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 Blaze.

SPONSORED Still waiting on your CI build? Speed it up ~3x with Blaze - change one line, pay less, keep your existing GitHub workflows. First 25 HWS readers to use code HACKING at checkout get 50% off the first year. Try it now for free!

Reserve your 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.