SwiftData ModelCoders.swift:1069 Unable to decode

Hello Developer Support,

I have the following code and the following crash. How can the swift data model unable to decode and yet able to display the decoded value at the same time?!

What's missing here?

CODE:

@Model
final class DisplayCache {
        init(point: MKMapPoint) {
            self.point = point
        }
        var point: MKMapPoint
}

CRASH

SwiftData/ModelCoders.swift:1069: Fatal error: Unable to decode this value MKMapPoint(x: 74358466.66307731, y: 97927933.41833577)

MKMapPoint doesn’t conform to Codable so you can’t use it directly in your model. One solution is to store the coordinate properties in the model instead.

I wrote an extension for MKMapPoint to extend Codable

It was working all the way to iOS 26 rc, not sure what changed.

SwiftData ModelCoders.swift:1069 Unable to decode
 
 
Q