Good afternoon. It's not the first day I've been thinking about this task. I have a one-to-many CoreData table.
I was able to link Property to Folders. That is, folders contain many properties. A piece of code at the bottom, how to link the tables
var selectedFolder: Folders?
do {
arrayPropertys = try context.fetch(Property.fetchRequest())
arrayPropertys[indexPath.row].parentFolders = selectedFolder
}
On the main screen, I need to show the properties that are in a specific folder that is pressed. The amount I can take:
arrayPropertys[indexPath.row].parentFolders?.propertys!.count
Shows the quantity correctly. For example, there are 5 properties in one folder, and 2 properties in another.
The question is that I can't pull the attributes. There is a Name attribute, but because of the type of the NSSet object, it does not want to be shown.
I can't get the values out in any way, I've tried everything, I've read on the Internet. It doesn't work. I can see it and I can't reach it
use (parentFolders?.propertys?.allObjects as? [Property])
to access the objects as an Array<Property>