Hey there, pretty new to coding with swift but I have a quiz app which has about 100 questions in an index path, and want the game to end at say 30 questions, any way I could do this? Any help would be greatly appreciated
What do you mean, in a tabView ?about 100 questions in an index path
So, just create a property in the classwant the game to end at say 30 questions,
Code Block var questionsAsked = 0
Each time you ask a question, increment it by 1
Code Block questionsAsked += 1
And before asking a new question, test
Code Block if questionsAsked >= 30 { // alert user that game is over }
If that answers your question, don't forget to close the thread by marking the correct answer, otherwise, please explain more your problem.
Yep it was for a tabView, makes complete sense now that I look at that, saved the day cheers mate I owe you one!
You should have marked the correct answer, not your comment.
Yep.
Note: TabView don't have indexPath. But TableView have.
Yep.
Note: TabView don't have indexPath. But TableView have.