mercredi 1 septembre 2021

Collecting data from a random generated label collection

I am generating these tables made from random labels based on data arrays:

label1.text = quizBrain.cities.randomElement()
label2.text = quizBrain.cities.randomElement()
label3.text = quizBrain.cities.randomElement()
label4.text = quizBrain.cities.randomElement()
label5.text = quizBrain.cities.randomElement()
label6.text = quizBrain.cities.randomElement()
label7.text = quizBrain.cities.randomElement()
label8.text = quizBrain.cities.randomElement()
label9.text = quizBrain.cities.randomElement()
label10.text = quizBrain.cities.randomElement()
label11.text = quizBrain.cities.randomElement()
label12.text = quizBrain.cities.randomElement()
label13.text = quizBrain.cities.randomElement()
label14.text = quizBrain.cities.randomElement()
label15.text = quizBrain.cities.randomElement()

There are 15 randoms labels being generated but I need to capture the data being displayed to be able to ask questions relating to such data that is being displayed only temporarily and generate appropriate questions.

Can I do that using UserDefaults? or what is the best way?

Thank you in advance.




Aucun commentaire:

Enregistrer un commentaire