I'm encountering an issue when trying to store a SIMD3<Float>
in a SwiftData model. Since SIMD3<Float>
already conforms to Codable
, I expected it to work. However, attempting to store a single SIMD3<Float>
crashes with the following error:
Fatal error: Unexpected property within Persisted Struct/Enum: Builtin.Vec4xFPIEEE32
Interestingly, storing an array of vectors, [SIMD3<Float>]
, works perfectly fine. The issue only arises when trying to store a single SIMD3<Float>
.
I’m not looking for a workaround (I can break the vector into individual floats in a custom codable struct to get by) , but I’d like to understand why storing a codable SIMD3<Float>
in SwiftData results in this crash. Is this a limitation of SwiftData, or is there something I’m missing about how vectors are handled?
Any insights would be greatly appreciated!
I think this is one of those cases where the why doesn’t matter [1]. If you need to do something and it doesn’t work, the path forward is clear: File a bug about that.
Please post your bug number, just for the record.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
[1] Well, the why kinda matters when you go to file you bug, in that you choose to make it a bug report or an enhancement request. But it doesn’t really matter, because your feedback is going to be seen by the same folks either way.