Entering a maximum number of questions for quiz app

Hey everyone i'm really new to coding and am loving it so far, i've made a pretty basic quiz app although it does have just over 100 questions, the game sets an alert at the end of all 100 questions but I want it to end at say 10 or 30 and so on, heres some code would I insert here or where my questions are? thanks in advanced




     let answer = question.answers[indexPath.row]
    if checkAnswer(answer: answer, question: question) {
      if let index = gameModels.firstIndex(where: { $0.text == question.text }) {
        if index < (gameModels.count + 1) {
          //next question
          let nextQuestion = gameModels[index+1]
          print("\(gameModels.shuffle())")
          currentQuestion = nil
          configureUI(question: nextQuestion)
          self.scoreBoard += 1
          self.scoreLabel.text = String(scoreBoard)
           
        }
        else {
          //end of game

          let alert = UIAlertController(title: "Done", message: "You beat the game", preferredStyle: .alert)
          alert.addAction(UIAlertAction(title: "Dismiss", style: .cancel, handler: nil))
          present(alert, animated: true)
        }
Entering a maximum number of questions for quiz app
 
 
Q