I have a view controller where I present a multiple choice question to the user. The idea is to skip to next question, so I would like to call the same viewcontroller (newsViewController) again to each new question just changing the variable question. I have a button btnNetQuestionAction. I tried this solution, and it works fine. is this a good approach ? Any better idea ?
@IBAction func btnNetQuestionAction(_ sender: Any) {
question = question + 1
if question > total {
question = total
}
UserDefaults.standard.set(questao,forKey: "questao")
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewController(withIdentifier: "newsViewController") as UIViewController
navigationController?.pushViewController(vc,animated: true)
}