David Wu David Wu - 10 months ago 53
Swift Question

Core data NSManaged subclasses already exist in Library

So, when my data model is ready, I tried to generate the subclasses when my data model file is open:

Editor -> Create NSManaged Object Subclasses

Okay, two files are generated, one is class declaration, the other is the property.

However, I was immediately prompted that I did a redeclaration of a class that already exists. This is where the original generated files are:
previously generated files

My question is obvious:

  1. When were those two files generated?

  2. What to do if I want those files in my project navigator, and, of course, the same folder as my ViewController?

Answer Source

You are generating files which have already been generated for you by Xcode and thus get duplicate declarations.

Find detailes in this answer.