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>
17 lines
475 B
Swift
17 lines
475 B
Swift
import Foundation
|
|
import SharedModels
|
|
|
|
struct WidgetDataReader {
|
|
static let suiteName = "group.com.conjuga.app"
|
|
static let dataKey = "widgetData"
|
|
|
|
static func read() -> WidgetData {
|
|
guard let shared = UserDefaults(suiteName: suiteName),
|
|
let data = shared.data(forKey: dataKey),
|
|
let decoded = try? JSONDecoder().decode(WidgetData.self, from: data) else {
|
|
return .placeholder
|
|
}
|
|
return decoded
|
|
}
|
|
}
|