Hi,
I want to save a attributes of an entity that has one-to-one relationship. For example, above is a screen shot of a part of my model. “Teshis” entity has relationship to TME entity (there can be many teshis but only one TME for each). In my code I can save Teshis entity like this:
teshisler is a relationship from hasta entity.
let teshisEntity = NSEntityDescription.entityForName("Teshis", inManagedObjectContext: managedContext)
let yeniTeshis = Teshis(entity: teshisEntity!, insertIntoManagedObjectContext: managedContext)
yeniTeshis.tarih = NSDate()
yeniTeshis.notlar = notlar_TF.text
yeniTeshis.onTani = onTani_TF.text
yeniTeshis.tedaviPlani = tedaviPlani_TF.text
let teshisler = hasta.teshisler!.mutableCopy() as! NSMutableOrderedSet
teshisler.addObject(yeniTeshis)
hasta.teshisler = teshisler.copy() as? NSOrderedSet
do {
try managedContext.save()
} catch let error as NSError {
print("Could not save:\(error)")
}
my question is how can I save “r_Kliking” attribute of TME to my context and how can I retrieve it back?