See how simple it is to fetch data, and begin thinking in terms of entities for requests instead of table joins from the database.
- View Offline
- [Instructor] So we've talked about…how to get the structure of our database…or how to to create this ManagedObjectModel,…and that's of course using the Model Editor,…but now let's talk about how we can get the data…out of the database and into your app.…All of this revolves around the FetchRequest,…and FetchRequest needs an entity description,…and you can use predicates…to filter and a SortDescriptor,…but everything that comes out is a ManagedObject…or a subclass of it that represents your entity.…
So the basic element of this is of course a FetchRequest.…It's basically a request to fetch data,…and in order to execute FetchRequests,…in order for them to get the data out,…you need to have some sort of context.…In here we have some fake parentContext,…and we also have some string of an entityName.…So we create this FetchRequest with the entityName,…and then we ask the parentContext…to execute the FetchRequest.…If you look at the end of that,…we're casting it to the array of the type…of data that we're expecting to come out of that.…
This course is meant for the enterprise developer who wants to get up to speed with the latest methods with Core Data. Instructor Jon Bott starts with a review of the basics, explaining the different architectural data models currently in use, the issues that can arise from these different models, and how the latest changes in Core Data 2016 simplify these models. He wraps up with hands-on migration to the new APIs and further tips on leveraging them in iOS 10 and macOS 10.12 apps.
- Fetching data
- Working with objects, queues, and threads
- Understanding the architectural models
- Managing local and server-side data
- Understanding iOS 10 and macOS 10.12 updates to Core Data
- Migrating to the new core data