Conclusion - Intermediate Core Data - raywenderlich.com
1,929 views · Published 14 September 2017 · 3:13 · Indexed 23 October 2026
Channel: Kodeco · 2017 · Education
This video covers the basics of using the fetched results controller with table views in iOS. View the updated course over here: https://videos.raywenderlich.com/courses/61-intermediate-core-data/lessons/1 --- About www.raywenderlich.com: raywenderlich.com is a website focused on developing high quality programming tutorials. Our goal is to take the coolest and most challenging topics and make them easy for everyone to learn – so we can all make amazing apps. We are also focused on developing a strong community. Our goal is to help each other reach our dreams through friendship and cooperation. As you can see below, a bunch of us have joined forces to make this happen: authors, editors, subject matter experts, app reviewers, and most importantly our amazing readers! --- Core Data is a framework that you use to manage the model layer objects in your application. It provides generalized and automated solutions to common tasks associated with object life cycle and object graph management, including persistence. Core Data typically decreases by 50 to 70 percent the amount of code you write to support the model layer. This is primarily due to the following built-in features that you do not have to implement, test, or optimize: Change tracking and built-in management of undo and redo beyond basic text editing. Maintenance of change propagation, including maintaining the consistency of relationships among objects. Lazy loading of objects, partially materialized futures (faulting), and copy-on-write data sharing to reduce overhead. Automatic validation of property values. Managed objects extend the standard key-value coding validation methods to ensure that individual values lie within acceptable ranges, so that combinations of values make sense. Schema migration tools that simplify schema changes and allow you to perform efficient in-place schema migration. Optional integration with the application’s controller layer to support user interface synchronization. Grouping, filtering, and organizing data in memory and in the user interface. Automatic support for storing objects in external data repositories. Sophisticated query compilation. Instead of writing SQL, you can create complex queries by associating an NSPredicate object with a fetch request. Version tracking and optimistic locking to support automatic multiwriter conflict resolution. Effective integration with the macOS and iOS tool chains. Creating a Managed Object Model Much of Core Data’s functionality depends on the schema you create to describe your application’s entities, their properties, and the relationships between them. Core Data uses a schema called a managed object model — an instance of NSManagedObjectModel. In general, the richer the model, the better Core Data is able to support your application. A managed object model allows Core Data to map from records in a persistent store to managed objects that you use in your application. The model is a collection of entity description objects (instances of NSEntityDescription). An entity description describes an entity (which you can think of as a table in a database) in terms of its name, the name of the class used to represent the entity in your application, and what properties (attributes and relationships) it has. Creating an Entity and Its Properties When you start a new project in Xcode and open the template selection dialog, select the Use Core Data checkbox. A source file for the Core Data model is created as part of the template. That source file will have the extension .xcdatamodeld. Select that file in the navigator area to display the Core Data model editor. Entity Name and Class Name Note that the entity name and the class name (a subclass of NSManagedObject) are not the same. The entity structure in the data model does not need to match the class hierarchy. Figure 2-2 shows a class name with the recommended class name pattern of Objective-C, along with an MO suffix. An entity name and a class name are required. Fetched Results Controller A controller that you use to manage the results of a Core Data fetch request and display data to the user. While table views can be used in several ways, fetched results controllers primarily assist you with a master list view. UITableView expects its data source to provide cells as an array of sections made up of rows. You configure a fetch results controller using a fetch request that specifies the entity, an array containing at least one sort ordering, and optionally a filter predicate. The fetched results controller efficiently analyzes the result of the fetch request and computes all the information about sections in the result set. It also computes all the information for the index based on the result set.
More from this channel
-
0:28
The Ant and The Chrysalis | Wild Fables
-
0:45
Cocos2D Via Minigames Workshop Trailer
-
0:13
Wild Fables | Crane Neck Experiment
-
1:11
iOS Winter Wonderland
-
0:36
The Country Mouse and the City Mouse | Wild Fables
-
1:24
The iOS Christmas Song
-
1:13
iOS Games by Tutorials: Juice Your Game
-
1:00:36
January 2015 Tech Talk: WatchKit