|
hello i'm very new to programming and i have just start the 100 Days of SwitUI. I really need help because it's been two days since I try to solve the first challenge. I create the buttons in a ForEach and try to access the button selected by the user to check. But the score is very werdly count (i understand that my check function is call several times...) Your help would be very much appreciated. Thank you my code:
|
|
I am a bit busy to debug your code now, but I have written this long time ago, hope it helps. https://github.com/EpiGardenia/100DaysOfSwiftUI/tree/master/Day25_Milestone1 |
|
|
|
i try to improve my code, unfortunately i still have an issue: in the ForEach I get the index of the button to check the answer, but the ForEach repeats 3 times and so the function to check the answer... i don't understand why the function to check repeats 3 times in my code and not in the other solution i could find.
|
|
Your main problem is down to using a Also you do not need the
|
|
BUILD THE ULTIMATE PORTFOLIO APP Most Swift tutorials help you solve one specific problem, but in my Ultimate Portfolio App series I show you how to get all the best practices into a single app: architecture, testing, performance, accessibility, localization, project organization, and so much more, all while building a SwiftUI app that works on iOS, macOS and watchOS.
Sponsor Hacking with Swift and reach the world's largest Swift community!
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.
Link copied to your pasteboard.