0

I want to make a Quiz within my SwiftUI-App and I'm wondering how I can go back to the RootView (which has a TabBar) after asking several Questions.

In theory my Quiz should work like This:

  1. First Go to the "Game" Tab on the TabBar
  2. Click the on the NavigationLink with "Quiz" in the PrimaryView
  3. Get Infos about the Quiz and start the Quiz in the StartQuizView
  4. Answer Question 1 in the QuizQuestionView
  5. See if Answer 1 is correct or not in the AnswerQuizView
  6. Answer Question2 in the QuizQuestionView
  7. See if Answer 2 is correct or not in the AnswerQuizView and go back to Primary View

So it should look like this:

PrimaryView -> StartQuiz -> Question1 -> Answer1 -> Question2 -> Answer2 -> PrimaryView

how can I do this - my Way is working until the Answer2 View, but I can't get back to the root view: PrimaryView and since I work with the same views (QuestionView & AnswerView) several times but with other data I can't really understand how the NavigationStack(path: ) works...

So does it give an opportunity - where I can push a button on the Answer2-View to go back to PrimaryView ?

SCH361
  • 41
  • 1
  • 7

0 Answers0