Post

Replies

Boosts

Views

Activity

Reply to SwiftData Tables disappearing while test my app!
At this point I have a couple of questions. First one is regarding your first response. Were you saying some how swiftdata know I change one of the table models and I need to do a migration? Secondly, I wanted to be able to to a clean build and have the app run as if it was the very first run, so I am thinking I need to delete any and all swiftdata persistent data. For now I am not using cloudkit. So, what you described in your second answer is how to do this? So, I am trying to find the cause and a resolution for the tables being dropped Thanks
Aug ’24
Reply to SwiftData Tables disappearing while test my app!
A few more points to add to this issue: I used another computer which had never been used for testing my app. macOS Sonoma as well as Xcode 15.4 was used. Same issue. To me this suggests I have some in the source or Xcode settings is causing this behavior. I changed my source to I changed this code to print the SwiftData containers etc. var sharedModelContainer: ModelContainer = { let schema = Schema([ ArtPiece.self, Clientele.self, TrackingArt.self, Invoice.self, InvoiceItem.self, AppSettings.self, Pay.self ]) let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false) do { let container = try ModelContainer(for: schema, configurations: [modelConfiguration]) // Add print statements here print("ModelContainer:", container) print("Configurations:", container.configurations) print("Schema:", container.schema) return container } catch { fatalError("Could not create ModelContainer: \(error)") } }() I see this line on the Xcode Debug Console url: file:///Users/bobsoule/Library/Containers/B43D6A46-213E-427E-ACE5-B7EE77071C0C/Data/Library/Application%20Support/default.store However I don't see this folder B43D6A46-213E-427E-ACE5-B7EE77071C0C in /Users/bobsoule/Library/Containers I have the issue on Xcode15 as well as Xcode 16 beta I have attached the Debug Console Log from this test. I am able to create and populate with data three of the tables before this issue arrises. debugConsole.txt
Aug ’24
Reply to Swiftui Table statement conditional table columns
So here is all the code Table(artViewModel.filteredArtPieces, selection: $selection, sortOrder: $sortOrder, columnCustomization: $columnCustomization) { TableColumn("Image") { artPiece in if let imageData = artPiece.artImage.first, let image = UIImage(data: imageData!) { Image(uiImage: image) .resizable() .frame(width: 50, height: 50) } else { Image(systemName: "photo") .resizable() .frame(width: 50, height: 50) } } .customizationID("Image") TableColumn("Name", value: \.artName) .customizationID("Name") TableColumn ("Art ID", value: \.artPieceID) { artPiece in Text(String(artPiece.artPieceID)) } .customizationID("Art ID") TableColumn ("Price", value: \.artPrice) { artPiece in Text (formatMoneyDouble(artPiece.artPrice)) } .customizationID("Price") TableColumn ("Date", value: \.artcreateDate) { artPiece in Text (artPiece.artcreateDate, style: .date) } // .resizable() .customizationID("Date") TableColumn("Artist", value: \.artistName) .customizationID("Artist") TableColumn("Meduim", value: \.artMedium) .customizationID("Meduim") TableColumn("Type", value: \.artType) .customizationID("Type") TableColumn("Status", value: \.artStatus) .customizationID("Status") TableColumn("Location", value: \.artLocation) .customizationID("Location") /* I want to create columns for this variable var artDefinedFields: [ArtDefinedFields] = [] which is defined in the datasource . */ } .tableStyle(.inset) struct ArtDefinedFields: Identifiable, Codable, Hashable { var id = UUID() var name: String var value: String var isVisible: Bool }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’24