I would like to store an array which includes NSObjects into a core data entity. I did several things trying to run it correctly but everytime I change something I get other issues.
This is my Entity named P_TrainingPlans
I can store the name and date attribute without any problems.
let appDelegate = UIApplication.shared.delegate as! AppDelegate
let context = appDelegate.persistentContainer.viewContext
let trainPlan = P_TrainingPlan(context : context)
createTrainingPath() //adds objects of type TrainingTool to selectedTrainingTools array
trainPlan.date = NSDate.init()
trainPlan.name = nameOfPlan.text
//trainPlan.trainingPath = selectedTrainingTools as NSArray?
appDelegate.saveContext()
The out-commented code doesnt work - thats the problem..
My aim is to store NSObjects of type TrainingTool into the trainingPath attribute of type Transformable.
How can I do that?
I also tried to create another entity for TrainingTool instead of a TrainingTool as NSObject class. Then the save process worked but the app crashed when fetching P_TrainingPlan entity..