Post

Replies

Boosts

Views

Activity

Reply to SwiftData Transformable with String Array
Ok, I think I figured it out. So.. when you generate SwiftData Objects from Core Data and if you have Transformable Data like above what I've done with an Array of Strings, you will get @Attribute(.transformable(by: "NSSecureUnarchiveFromData")) var yourArrayOfStrings: [String]? However, SwiftData is so good that it already recognizes these Array of Strings so having that Attribute confuses Xcode to thinking you're using NSKeyedUnarchiveFromData. The solution is to just delete that attribute like so... var yourArrayOfStrings: [String]? And it just works! The warning goes away in the Debugger.
Mar ’24
Reply to SwiftData error: NSKeyedUnarchiveFromData' should not be used to for un-archiving and will be removed in a future release
Same issue with my transformable array of strings in Xcode 15.2 and iOS 17.3. I'm switching from CoreData to SwiftData and using NSSecureUnarchiveFromData. But still get this error and then the app crashes due to memory. Frustrating I can't move to SwiftData after all of the work I put into changing my code. Good thing I saved a copy of the CoreData version. https://developer.apple.com/forums/thread/744688
Jan ’24