I'm building an app that requires a core data relationship as such:
entityA <<---> entityB (e.g. any given entityA can hold many entityB objects)
I have two tableviews with entityA list items in which I want to be able to store entityB objects in any given entityA object.
I'm new to using relationships with core data (and fairly new to swift) and would like to learn how to make this work. Does anyone have any swift tutorials in mind that would be good for me to take a look at or any other resources that may help me learn?
Sorry if my question doesn't make much sense, ask me to clarify if you need.
Thanks!
UPDATE:
Here's a bit more specificity on what I'm wanting to learn.
Lets say I have the entity "Person" (attributes may include name, age, etc.) and a tableview in which my app users can add a person to. (this I have established and know how to do appropriately) But, now I want to add the entity "Meal" (attributes may include food items), and Meal is a tableview of its own that I can access by choosing the person that I want to add a meal to. Each person can have more than one meal, but there can only be one person per meal.
The question is: what would my core data model, fetchRequests, etc look like in order to accomplish this?
Hope that is clear enough! :)
Thanks
Here's a code snippet of my function for creating a meal:
func createMeal() {
let entityDescription = NSEntityDescription.entityForName("Meal", inManagedObjectContext: managedObjectContext!)
let meal = Meal(entity: entityDescription!, insertIntoManagedObjectContext: managedObjectContext)
meal.mealName = mealNameTxt.text
meal.mealItem1 = mealItem1Txt.text
managedObjectContext?.save(nil)
}