In this app I save an NSOrderedSet of cards to a "Subject" entity in core data so that users can quiz themselves. The card flips and drags in tinder like fashion well but in the update card method I'm having some trouble. The current card displays fine as I set that in view did load (the first card of the NSOrderedSet's array property). When I drag and update however it immediately goes to the last card, for example if I have 5 cards in a deck it will start with the first then immediately go to the fifth. What would be the best way to update this method so that it will cycle through as desired?
I suppose I should pass it an index property like a tableViewDelegate method but if someone has done something like this before and has a better way that's greatly appreciated.
Thanks for the help like always.
func updateCard() {
//cycle through questions here
for var i = 0; i < (self.subject.cards?.count)!; i++ {
self.currentCard = self.subject.cards?.array[i] as? Card
self.draggableView.questionLabel.text = self.currentCard?.question
self.draggableView.answerLabel.text = self.currentCard?.answer
}
}