[ad_1]
I’ve an array of struct, after clicking the proper reply( code beneath ) I need to change the array index from questions[0] to questions[1], I meant to maneuver via arrays. is it potential in any easy methods ?
any resolution will likely be appericated
var questions:[EasyQuestions] = [
EasyQuestions(question: "1 + 1", optionA: "5", optionB: "2", hint: "3-1", correctAnswer: 1),
EasyQuestions(question: "2 + 2", optionA: "4", optionB: "3", hint: "5-1", correctAnswer: 0)
].shuffled()
override func viewDidLoad() {
tremendous.viewDidLoad()
configure(with: questions[0])
}
@IBAction func buttonClicked(_ sender: UIButton) {
if sender.tag == questions[0].correctAnswer {
print("The reply is right") // after printing this I need to transfer on the following ingredient of questions array
}
}
func configure(with query: EasyQuestions){
self.Query.textual content = query.query
self.button1.setTitle(query.optionA, for: .regular)
self.button2.setTitle(query.optionB, for: .regular)
}
[ad_2]
