Using a relationship I am able to pair entries together, but cannot figure out how to exactly match the customer that I am looking for, nor to create new records without overwriting the old ones.
I would like to search for all records for October 2023, with those of ages between 20-40, how do I create a fetch request for that ?
On top of that, I need to amend records, and of course create new years to attach records to, something I am having difficulty with.
Code Block let userEntryRecord = NSEntityDescription.entity(forEntityName: “Record”, in: managedContext)! let userEntryCustomer = NSEntityDescription.entity(forEntityName: “Customer”, in: managedContext)! let dataRecord = NSManagedObject(entity: userEntryRecord, insertInto: managedContext) as? Record let dataCustomer = NSManagedObject(entity: userEntryCustomer, insertInto: managedContext) as? Customer dataRecord?.year = “2021” dataRecord?.month = “March” dataRecord?.addToCustomer(dataCustomer ?? Customer()) dataCustomer?.age = 20 dataCustomer?.gender = “male” dataCustomer?.country = “UK
I would like to search for all records for October 2023, with those of ages between 20-40, how do I create a fetch request for that ?
On top of that, I need to amend records, and of course create new years to attach records to, something I am having difficulty with.