Posts

Post marked as solved
1 Replies
82 Views
Hi, I am developing a multi platform application using SwiftData. Since a few days, when running the macOS version I cannot create the model container while on iOS everything is fine. On macOS I receive the error : Thread 1: Fatal error: Could not create ModelContainer: SwiftDataError(_error: SwiftData.SwiftDataError._Error.loadIssueModelContainer) The code that initialize the model container is : let schema = Schema([ Account.self, ABCategory.self ]) let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false) do { let container = try ModelContainer(for: schema, configurations: [modelConfiguration]) container.mainContext.undoManager = UndoManager() return container } catch { fatalError("Could not create ModelContainer: \(error)") } } var body: some Scene { WindowGroup { ContentView(accuBalanceModel: accuBalanceModel) } .modelContainer(sharedModelContainer) //.modelContainer(for: [Account.self, ABCategory.self], inMemory: false, isUndoEnabled: true) #if os (OSX) // // Remove the 'New Window' menu item. // .commands { CommandGroup(replacing: CommandGroupPlacement.newItem) { } } #endif } I can say that the model has no issues as it works when running on IOS and also, if I change inMemory: false with inMemory: true the macOS version succeed in creating the model. I can also say this is not a network issue as the Mac and the iOS device running the application are connected to the same box. The Xcode version is Version 15.2 (15C500b) Ios device where everything is fine : iPhone 11 OS 17.3.1 (21D61) the Mac device : Mac mini M1 2020 : 14.0 (23A344) Any advice to resolve that problem would be greatly appreciated. Best Regards Christophe Lestrade
Posted
by Chris Tof.
Last updated
.
Post marked as solved
1 Replies
90 Views
I am developing a SwiftData application using CloudKit. I have been playing with the app for a while and populated the database. Recently I decided to change the type of an attribute. So I reseted the scheme in CloudKit Console to the production one, which actually is empty for now, so I restart from scratch. Unfortunatly, the locally cached database on my Mac is using the old schema and my app fails loading the ModelContainer because of the type incompatibilities. I would like to delete the locally cached database but I haven't a clue of where it can be. I do not want to go through a migration plan for that. Does someone know where can I find it ? Chris tof
Posted
by Chris Tof.
Last updated
.
Post marked as solved
3 Replies
1.6k Views
Hello.I am implementing a SwiftUI Drag and Drop application which runs fine on both macOX and IpadOS.The only problem I have is that on iPadOS, the Dragged image is rendered just as an empty rectangle, while on macOS I have a correct dragged image.The body of the view from which the items are dragged is : var body: some View { HStack { ForEach( libraryRowItems, id: \.self) { thelibraryItem in libraryItemView(item: thelibraryItem) .onDrag { return NSItemProvider(object: NuageIdentifier(identifier:thelibraryItem.id)) } } } }and the body for libraryItemView : var body: some View { let topColorGradient = Color(Color.RGBColorSpace.sRGB, red: 0.298, green: 0.301, blue: 0.301); let bottomColorGradient = Color(Color.RGBColorSpace.sRGB, red: 0.235, green: 0.239, blue: 0.239); return ZStack { RoundedRectangle(cornerRadius: 5) .fill(LinearGradient(gradient: Gradient(colors: [topColorGradient, bottomColorGradient]), startPoint: .top, endPoint: .bottom)) Text("\(text)").foregroundColor(.white).font(.custom("STIX2Math", size: fontSize)) } .frame(width:50, height: 33) }On my late 2013 mac everything is okOn my Ipad 5th generation the dragged iage is just a rectangle.My mac is unable to run it on a Simulator (seems to be too slow now) to see if it could depends on the generation of the device.I am the only one to encounter this problem ?RegardsChris Tof
Posted
by Chris Tof.
Last updated
.