Relative Content

Tag Archive for swiftswiftdata

SwiftData migration crashing with default value

Doing light migration, using default value, rather than optional value for new param does not seems to work and keeps crashing.
I recall an Apple SwiftData migration guide, but it seems to be gone, so I could not find any mention regarding this.

Need help updating my modelContext in SwiftData

I am trying to create an iOS app where when I scan a product, information about it comes up. When I scan a product, I want it to be stored using SwiftData and displayed in my History page. For some reason, whatever I have tried isn’t working.

SwiftData deleting model with Predicate

I’m seeing unusual behaviour in SwiftData when selectively deleting models using a predicate with try modelContext.delete(model: where:). I have an easy workaround, but struggling to see why it works.