From 23dfc75e31a8666eaba14de9f87bf82ac95c05d9 Mon Sep 17 00:00:00 2001 From: Dustin Mierau Date: Sat, 8 Nov 2025 15:32:46 -0800 Subject: Thinking through how to store chat history in SwiftData instead. --- Hotline/MacApp.swift | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/Hotline/MacApp.swift b/Hotline/MacApp.swift index b1cc1af..9052c0b 100644 --- a/Hotline/MacApp.swift +++ b/Hotline/MacApp.swift @@ -71,10 +71,24 @@ struct Application: App { private var modelContainer: ModelContainer = { let schema = Schema([ - Bookmark.self + Bookmark.self, + // ChatMessage.self ]) - let config = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false, cloudKitDatabase: .private("iCloud.co.goodmake.hotline")) - let modelContainer = try! ModelContainer(for: schema, configurations: [config]) + + // For records we want shared across devices. + let cloudKitConfiguration = ModelConfiguration( + schema: Schema([Bookmark.self]), + isStoredInMemoryOnly: false, + cloudKitDatabase: .private("iCloud.co.goodmake.hotline") + ) + + // For records we only need stored locally. +// let localConfiguration = ModelConfiguration( +// schema: Schema([ChatMessage.self]), +// isStoredInMemoryOnly: false +// ) + + let modelContainer = try! ModelContainer(for: schema, configurations: [cloudKitConfiguration]) // Print local SwiftData sqlite file. // print(modelContainer.configurations.first?.url.path(percentEncoded: false)) -- cgit