按 W2 plan Task 2 落地数据模型: - Indicator 加 report / asset / pinned 字段 - Report 加 indicators / assets @Relationship(cascade) - DiaryEntry 加 tags - 新增 @Model Asset (原图元数据) - 新增 @Model ChatTurn (问答历史 + 引用) - TijiApp Schema 加入新 model 注:Schema 破坏性变更,用户需在 Xcode 里 Erase Simulator 后重启 App。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
29 lines
700 B
Swift
29 lines
700 B
Swift
import SwiftUI
|
|
import SwiftData
|
|
|
|
@main
|
|
struct TijiApp: App {
|
|
var sharedModelContainer: ModelContainer = {
|
|
let schema = Schema([
|
|
Indicator.self,
|
|
Report.self,
|
|
DiaryEntry.self,
|
|
Asset.self,
|
|
ChatTurn.self,
|
|
])
|
|
let config = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false)
|
|
do {
|
|
return try ModelContainer(for: schema, configurations: [config])
|
|
} catch {
|
|
fatalError("Could not create ModelContainer: \(error)")
|
|
}
|
|
}()
|
|
|
|
var body: some Scene {
|
|
WindowGroup {
|
|
RootView()
|
|
}
|
|
.modelContainer(sharedModelContainer)
|
|
}
|
|
}
|