Using Swift and Core Data, I want to store an array of custom Game objects in my custom User class in the database.
The GameOwned variable is a Transformable. I want to be able to store [Game] inside the database.
How can I go about achieving this? Is there anything special I need to do in order to be able to read it once I pull it from the database other than casting it to [Game]?
User Class
class User: NSManagedObject {
@NSManaged var gameOwned: AnyObject
}
Game Class
class Game: NSManagedObject {
@NSManaged var coverPhoto: String
@NSManaged var genre: String
@NSManaged var id: String
@NSManaged var isActive: NSNumber
@NSManaged var isOwned: NSNumber
@NSManaged var name: String
@NSManaged var platform: String
}