pop over crash swiftUI on macOS

I have a question regarding popover. I am currently developing a macOS application were we create logs in core data when an attribute gets altered by the user. I want to display the logs in a table inside a popover. However when I start the app it opens the popover perfect for the first time but when the popover closes or want to reopen again it crashes with error: code=1, address=0x5a1a31562420. We don't refetch the logs when reopening the popover, the log amount stays the same. After investigating I came to the conclusion that it's due to an attribute that keeps crashing, but there are 2 other attributes that are exactly the same.

model applicationLog: parent entity / abstract entity
auditDateTime: Date optional
field: String optional
newValue: string optional -> attribute that crashes
oldValue: string optional

    @Environment(\.managedObjectContext) private var viewContext
    
    @Binding var logs: [CustomerLog]
    
    var body: some View {
        Table(logs) {
            TableColumn("Date") { log in
                Text((auditDateTime(for: log)))
            }
            TableColumn("User") { log in
                Text(log.userName ?? "")
            }
            TableColumn("Old Value", value: \.oldValue)
            TableColumn("New Value", value: \.newValue)
        }

solutions I tried:

  • giving the context to the popover
  • making logs bindable
  • putting it in a lazyHStack inside a List
pop over crash swiftUI on macOS
 
 
Q