I'm working on a SRS-based Flashcard program in swift. My problem (other than being new at programming, haha) is... once I alter the values of due date, score, etc; how do I add them back to the wordBank array keeping the new property values?
I started out creating a class for other flashcards to inherit properties like word, translation, sentence 1 & 2, audio URL, score (1-100 for scheduling purposes), etc; etc;
class Flashcard {
var id: Int = 0
var score: Int = 0
var word: String = ""
var sentence1: String = ""
// etc; etc;
From here, I created a new file and class called words, inheriting the Flashcard properties.
class Words: Flashcard {
// Example word 1
let you = Flashcard()
you.id = 0
you.score = 2
you.word = "khun"
you.sentence1 = "khun blah blah"
// Example word 2
let me = Flashcard()
you.id = 1
you.score = 1
you.word = "pohm"
you.translation = "Me or I"
// Create an array of all the words that will be in the program
var wordBank: [Flashcard] = [you, me, him, her, them, it] // etc;
Now, from here I can sort
// Sort array by lowest
wordBank.sort({ $1.score > $0.score })
// Create a new array for testing Session
var SessionArray: [Flashcard] = []
// Add the lowest scores to the SessionArray for testing
SessionArray += WordArray[0...6]
For the sake of remembering, My problem is once I alter the values of due date, score, etc; how do I add them back to the wordBank array keeping the new property values? I won't bother asking about how to persist this data right now, lol. I'm still reading about core data.
Thanks for any help you can give me!