how to randomly display data in SwiftUI?
typical use case for flash cards...
I have shelves that contain boxes that contain cards. i want to randomly select a card from a box and display its data (front) and accept user input (right or wrong) and increment
card.level
if user selects "right" or decrement if he/she selects "wrong", after he/she has seen the back of the card.
How to approach this use case?
Have a nice day, and thank you!3 Replies
augment the cards with a
sort
field which is assigned Float.random(in:)
, then sort the array by that fieldwhat range should i put in there ?
0..1 should be fine