Created 2 Entity. The Entity Post has a link to the .Post class.

Actually, with this entity, I created the PhotoDataPost class.

So the questions are: 1) How does Entity understand which class it is attached to and is it attached at all? 2) Why is there any .Post class specified in the line with entity Post?

enter image description here

    1 answer 1

    1) Yes, it is attached to the class specified in the class field.

    2) Xcode assumes that the class is called like an entity and is trying to help you with auto-completion.

    Why else you need a class: when you created your model in .xcdatamodeld, you can generate (or update) all the classes specified in the model. To do this, select File -> New -> File -> Core Data -> NSManagedObjectSubclass, xcode will ask for which files from the model to generate classes, and then generate the files you need, with the names that you specified in this very class field. At the same time, if you have not put an end to the beginning of the name, then in the generated class there will be a line @objc(Post) for using the class in release.