I am trying to save an array of 6 strings to CoreData, like this:
let imageUrls = ["image-url....", "image-url....", ..., "image-url"]
I have tried all methods stated in How to save Array to CoreData? and in Best practice? - Array/Dictionary as a Core Data Entity Attribute without success.
This is the method I am trying to do.
Inside my .xcdatamodeld, I have declared: imageUrl as a Transformable, see picture in link (couldn't attach it to the post, I'm sorry for that!): https://drive.google.com/file/d/1VJey55oD9KhOy1KDy59h8PweMMQnaK2-/view?usp=sharing
Inside my NSManagedObject class I have
@objc(Entity)
public class Entity: NSManagedObject {
@NSManaged public var imageUrls: [String]?
....
This is how I create the entity before saving it to CoreData:
entity.imageUrls = ["test", "test", "test"]
When I try to fetch the imageUrls, the fetched entity.imageUrls is equal to nil. I don't understand this. The expected results is the same array I saved to CoreData.
ANSWERED by Joakim Danielson