Beginning Core Data · Getting Started |

This is a companion discussion topic for the original entry at

You can avoid having the coreData files generated at the top level by using the Group dropdown menu in the file navigator as apposed to clicking on the correct file. If you select Data from the drop down menu Xcode will correctly place the files in the Data folder and you will not have to drag and drop them or deal with the possible file referencing weirdness that happens when Xcode creates the files outside the project like in the video

1 Like

Thanks for the heads up on that! It’s little things like that add up and improve the experience.

Brian, I don’t understand something about Core Data. Let’s say you’ve started building an app and the data model you are using is a struct that conforms to the Codable protocol. From what I’ve read, you can’t use a model that conforms to Codable within Core Data (unless you convert that model to be an instance of a class).

So essentially I have 2 questions:

  1. Can a struct that conforms to Codable be used within Core Data?
  2. It seems that you need to start configuring the data model within Core Data and create the NSManagedObject subclass FIRST, before you actually start doing any coding. This confuses me. It makes me believe that if I’ve already built an app and just need to incorporate persistence, then I should be doing all the Core Data stuff first.

Please advise?

@bdmoakley Can you please help with this when you get a chance? Thank you - much appreciated! :]