So, I understand that Core Data's new "Codegen" feature puts class files into "Derived Data" instead of your project... which is nice.
However, recently in the past it created two separate classes... one that you could manually delete and regenerate, and another that could contain your code/methods for those objects.
I tried turning "Codegen" but it doesn't seem to create the file for our code. How is this supposed to work if we want to add methods to Core Data objects? — Does anyone know how to get it working like before, just without the extra duplicate files, or is there some reason we shouldn't be doing that?
If you want to add your own code to the class then just set the Codegen dropdown to Category/Extension and it will only generate MyClass+CoreDataProperties.h and MyClass+CoreDataProperties.m into Derived Data, which you then need to include at the end of your MyClass.h header file, like before.
btw; it can be a bit finicky getting it to work properly as this setting sometimes doesn't save after you change it, so try save manually before you go to another file and then check the setting saved after. Also clean your project before you build or it might not generate the files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With