I know obj-c, but I learn fast.
In obj-c, when using master data, you model your data and specify xcode to subclass your model's nsmanageobject. Then in the code you initialize it as
#import MyObject - (void) someMethod { MyObject *my = (Card *) [NSEntityDescription insertNewObjectForEntityForName:@"Card" inManagedObjectContext:[self managedObjectContext]]; my.name = @"some name"; }
In swift, I am trying to do the same, but I cannot figure out how to initialize my custom object. This is what I have:
Subclass NSManagedObject created:
import Foundation import CoreData p>
class Card: NSManagedObject { @NSManaged var card_name: String @NSManaged var card_id: String @NSManaged var card_issuer: String @NSManaged var card_type: String }
Then I try to use it in another class, for example:
var card : Card card.card_name = "Some Name" card.card_issuer = "HOA" card.card_type = "Rec Center" card.card_id = "123"
But I get the error:
Map variable used before initialization
I clearly lack a step, but I canβt indicate what it is.
In addition, as mentioned by several iOS instructors, you should not interact with the created NSManagedObject subclass.
Any suggestions?
Edit I get an error: (probably there should be a new SO question ...)
CoreData: warning: Unable to load class with name 'Card' for entity 'Card'. The class was not found, using the default NSManagedObject instead.
Here are screenshots showing how this class exists in the build phase and the object name was set in the xcdatamodeld file 
Thanks