Initial commit: Conjuga Spanish conjugation app
Includes SwiftData dual-store architecture (local reference + CloudKit user data), JSON-based data seeding, 20 tense guides, 20 grammar notes, SRS review system, course vocabulary, and widget support. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
import SwiftData
|
||||
import Foundation
|
||||
|
||||
@Model
|
||||
final class ReviewCard {
|
||||
var key: String = ""
|
||||
var verbId: Int = 0
|
||||
var tenseId: String = ""
|
||||
var personIndex: Int = 0
|
||||
|
||||
var easeFactor: Double = 2.5
|
||||
var interval: Int = 0
|
||||
var repetitions: Int = 0
|
||||
var dueDate: Date = Date()
|
||||
var lastReviewDate: Date?
|
||||
|
||||
|
||||
|
||||
init(verbId: Int, tenseId: String, personIndex: Int) {
|
||||
self.key = Self.makeKey(verbId: verbId, tenseId: tenseId, personIndex: personIndex)
|
||||
self.verbId = verbId
|
||||
self.tenseId = tenseId
|
||||
self.personIndex = personIndex
|
||||
}
|
||||
|
||||
static func makeKey(verbId: Int, tenseId: String, personIndex: Int) -> String {
|
||||
"\(verbId)|\(tenseId)|\(personIndex)"
|
||||
}
|
||||
|
||||
func refreshIdentityIfNeeded() {
|
||||
let expected = Self.makeKey(verbId: verbId, tenseId: tenseId, personIndex: personIndex)
|
||||
if key != expected {
|
||||
key = expected
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Model
|
||||
final class CourseReviewCard {
|
||||
var id: String = ""
|
||||
var deckId: String = ""
|
||||
var front: String = ""
|
||||
var back: String = ""
|
||||
|
||||
var easeFactor: Double = 2.5
|
||||
var interval: Int = 0
|
||||
var repetitions: Int = 0
|
||||
var dueDate: Date = Date()
|
||||
var lastReviewDate: Date?
|
||||
|
||||
init(id: String, deckId: String, front: String, back: String) {
|
||||
self.id = id
|
||||
self.deckId = deckId
|
||||
self.front = front
|
||||
self.back = back
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user