I was trying to create NSManagedObject subclasses (2 related entities) automatically in Xcode. They are generated like this:
If you do not generate managed object subclass automatically, then don't forget to check "Codegen" settings for an Entity in Data Model Inspector: