OnCue/OnCuePresenter Watch App/OnCuePresenterApp.swift
2025-02-14 23:34:59 +13:00

62 lines
2.4 KiB
Swift

//
// OnCuePresenterApp.swift
// OnCuePresenter Watch App
//
// Created by Pradyun Setti on 22/06/2024.
//
import SwiftUI
import SwiftData
import CoreData
@main
struct OnCuePresenter_Watch_AppApp: App {
var sharedModelContainer: ModelContainer = {
let schema = Schema([
OCProject.self,
OCCard.self,
])
let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false)
do {
// #if DEBUG
// // Use an autorelease pool to make sure Swift deallocates the persistent
// // container before setting up the SwiftData stack.
// try autoreleasepool {
// let desc = NSPersistentStoreDescription(url: modelConfiguration.url)
// let opts = NSPersistentCloudKitContainerOptions(containerIdentifier: "iCloud.xyz.breadone.oncue")
// desc.cloudKitContainerOptions = opts
// // Load the store synchronously so it completes before initializing the
// // CloudKit schema.
// desc.shouldAddStoreAsynchronously = false
// if let mom = NSManagedObjectModel.makeManagedObjectModel(for: [OCProject.self, OCCard.self]) {
// let container = NSPersistentCloudKitContainer(name: "OnCue", managedObjectModel: mom)
// container.persistentStoreDescriptions = [desc]
// container.loadPersistentStores {_, err in
// if let err {
// fatalError(err.localizedDescription)
// }
// }
// // Initialize the CloudKit schema after the store finishes loading.
// try container.initializeCloudKitSchema()
// // Remove and unload the store from the persistent container.
// if let store = container.persistentStoreCoordinator.persistentStores.first {
// try container.persistentStoreCoordinator.remove(store)
// }
// }
// }
// #endif
return try ModelContainer(for: schema, configurations: [modelConfiguration])
} catch {
fatalError("Could not create ModelContainer: \(error)")
}
}()
var body: some Scene {
WindowGroup {
MainViewPresenter()
}
.modelContainer(sharedModelContainer)
}
}