我想通过它的键来获取数组值。
我在 looping 中用下面的代码设置了数组。
let que = Question(questionText: "\(questionWord)", options: quizAnsArr, correctAns: correctArrIndex, wrongAns: -1, isAnswered: false)
quizsArray += [que]
现在我得到下面的数组。这是我的数组。
[Kanji_Quiz.Question(questionText: "青", options: ["fast", "color", "heart", "blue"], correctAns: 3, wrongAns: -1, isAnswered: false), Kanji_Quiz.Question(questionText: "暑", options: ["owner", "heart", "hot (temperature)", "end"], correctAns: 2, wrongAns: -1, isAnswered: false)]
我通过使用调用值
print(quizsArray[questionText])
但它'显示错误。我如何通过索引或 smth 调用值。请帮我。