|
In the day 35 challenge I would like to understand how it works to switch between the views (GameView,SettingsView) using closures.
I tried a lot but without success and it would be great if someone can give me a hint.
I tried to understand the hint given by @FlyOstrich at SOLVED: Looking for clue for Day 35 challenge (Multiply!) but without success. Any ideas are welcome :-) Regards, Ralf |
|
First need a
Then in the ContentView you can have, which will show either view depend on
now need to be able to change between so add a method
but what needed is say number of questions to answer as a
need to be able set
and now can pass the
so now we need to be able to call the
This is very rough as just want to show how to pass the method from one view to another (took me age to get this). It might give you a starting point for the challange.
|
|
Hello @NigelGee, Thank you! You definitely made my day :-) Greetings Ralf |
|
I used some of these ideas in my version of the Day 35 challenge. I have it working well, except for when the game is over, I dont know how to get it to go back to SettingsView(). Going from SettingsView() to GameView() works and the game play works, I just cant figure out how to go backwards? setting gameStarted = false does nothing, and I tried a NavigationLink but I am not sure I did that correctly as that didnt work either... |
|
|
|
SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's all new Paywall Editor allow you to remotely configure your paywall view without any code changes or app updates.
Sponsor Hacking with Swift and reach the world's largest Swift community!
You need to create an account or log in to reply.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.