Apple Docs, iOS Development, Objective-C, Swift, SwiftUI

Reading Apple Docs to Better Understand CoreData Part 2

This is where it got a bit tricky, this was only the 2nd part. The reason it got tricky is because of the way the docs are laid out. I initially thought you could read the docs going from the top down and I am sure you could but not really because the Essentials part which is the first section is exactly what it sounds like the essentials, the bare minimum of what we need to know to use Core Data.

Reading this section made me realize that there had to be more about the Core Data Model, because it only talked about how to add a data model file to either a new Xcode project or an existing project. I may not be an expert but I know there is much more than just adding a file to a project.

After a quick glance at the contents of the documents, I saw a whole section dedicated to Data Modeling. That makes more sense as to the complexity of a Core Data Model. It needs much more than just one page.

So to reiterate, we will not be reading the docs from top to bottom we will be jumping around looking for information as we need it. I almost wonder if we should be building a project and not just reading the docs to better understand it. I think we will wait and see if a project is needed later, for now, we will stick to reading and making notes.

Data Modeling

The first section that I found that has to do with the Core Data Model is titled Modeling Data. Without getting too far ahead because I can see how that would be easy to do as we read into each topic, there are links to subtopics and we can just go into a whole new realm of topics. Sticking to just the topic of the Model, we can create a graph, not a database. I don’t know how many times I have heard it but because it’s worth repeating. Core Data is not a database. I like to think of it like a spiderweb because that is what it looks like sometimes especially in more complex models.

Image From: https://i.stack.imgur.com/Q7bas.png

An object graph is nothing more than a collection of interconnected objects. The Core Data framework excels at managing complex object graphs.

Parts of a Core Data Object

Every Object is also known as an Entity. The Entity has properties otherwise known as Attributes and then it has Relationships with other Entities.

More on this later but to be able to work with these entities in code they become NSManagedObjects.

  • First Post on Reading Apple Docs To Learn Core Data
  • The next post will be on Configuring a Core Data Model

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s