Book Image

Core Data iOS Essentials

Book Image

Core Data iOS Essentials

Overview of this book

Core Data is the essential ingredient in data driven iOS apps. It's used for storing, retrieving, and manipulating application data in databases, XML, and binary formats. It's an essential component for iPhone, iPod Touch, and iPad apps.Core Data Essentials provides a clear, readable guide to the most useful aspects of Core Data. Built around a realistic example app, the book showcases the most important aspects of Core Data development in the context of a complete, functioning app written in Objective C.The book starts with a tour of how the app works. Then you'll see how to easily display data using the Table View. You'll learn how to develop an appropriate data model that fits the needs of your app, then implement that model as updatable data objects. You'll see how to update data and build relationships between objects and learn how Core Data can work with search, and how to provide your users with friendly data editing features.
Table of Contents (19 chapters)
Core Data iOS Essentials
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
Appendix

Appendix A. Appendix

Attributes: Attributes are the variables within an entity. They are also known as columns of the table in database language terms. For example: name, address, contact number, and so on.

CGRect structure: The CGRect structure is used for holding the location and dimension of the frame of a window on the screen.

CGRectMake function: The CGRectMake function is used for defining the frame of a window of an object. With the help of this function, we specify the coordinates of the origin as well as width and height of the frame.

CGSize structure: The CGSize structure represents a size of a rectangle and is used for storing information related to width and height of the object.

CGSizeMake function: The CGSizeMake function is used for defining the width and height of an element.

Core Data API: The Core Data API is a stack that consists of three main components, NSPersistentStoreCoordinator, NSManagedObjectModel, and NSManagedObjectContext.

Data Model: The Data Model refers to the information of the entities, attributes, and relationships used in an application.

Data Model Editor: The Data Model Editor is an editor provided by the Core Data framework for creating the entity relationship model quickly.

Delegate: The Delegate is the class that confirms to the protocol and is responsible for implementing the methods of the confirming protocol.

Entity: An individual data object used to store complete information of the person, item, object, and so on. It is also known as a table in the database language.

FetchedResultsController: FetchedResultsController is an instance of the NSFetchedResultsController class and is used for managing the result, that is, the set of entities that are retrieved on the basis of FetchRequest.

FetchRequest: FetchRequest is an instance of the NSFetchRequest class and is used to access the objects in a managed object context.

Image Picker: The Image Picker is used for displaying images allowing the user to choose or pick any image. Photo library, Camera, and Saved photos are the three sources from where Image Picker can pick the images to display.

Interface Builder: The Interface Builder is a visual design tool that makes creation of user interfaces quite easy for iphone applications. Creation of user interface is as easy as dragging and dropping of controls from the Library window to the View window.

iPhone: iPhone is an Internet and multimedia-enabled smartphone designed and marketed by Apple Inc.

iOS SDK: iOS SDK is a software development kit (SDK) released by Apple that contains three important apps: Xcode, Interface Builder, and iPhone Simulator along with several resources. The iPhone SDK helps in writing applications for iPhone, iPod Touch, and also for iPad.

Key Value coding (KVC): KVC is used to store and retrieve data from the managed objects. The key value methods valueForKey: and setValue:forKey: are used for setting and retrieving attribute values from the managed object respectively.

Key Value Observing (KVO): Key Value Observing is the sister API to KVC and is used to inform us if a particular attribute of an object is changed.

Keypath: Keypath is a concept that helps in iterating through object hierarchies using a single string.

Mac OS X: Mac OS X is a series of Unix-based operating systems and graphical user interfaces developed, marketed, and sold by Apple Inc. It is included with all new Macintosh computer systems.

Managed Object Context: The objects that are fetched from the persistent storage are placed in managed object context to perform validations and to keep track of the changes made to the object's attributes.

Managed Objects: Managed objects are instances of the NSManagedObject class or its subclass that represent instances of an entity that are managed by the Core Data framework.

Migration: Migration tells Core Data to move data from the old persistent store to a new one that matches the current data model. Migrations are of two types: Lightweight and Standard.

Model View Controller: MVC where M stands for Model that represents the backend data, V stands for View that represents the user interface elements through which the user can interact with the application and C stands for Controller that represents the application logic that decides which view to display on the basis of actions taken by the user.

NSEntityDescription: NSEntityDescription contains information of the entity, such as its name, its attributes, relationships, and so on.

NSNotification: NSNotification is an object that is broadcasted by an NSNotificationCenter object for its observers.

NSPredicate: NSPredicate is a complex and powerful tool used to filter out the undesired instances of an entity and to display only the desired instances.

Persistence framework: A persistence framework moves the data to and from a permanent data store. It also manages the database and the mapping between the database and the objects.

Persistent Store: The Persistent Store is a data store (repository) that handles mapping between data (in the store) and corresponding objects in a managed object context.

PersistentStoreCoordinator: This is used to store and retrieve Managed Objects from the Persistent Store via ManagedObjectContext.

Predicate Builder: Predicate Builder is a tool that helps in creating predicates, that is, queries for extracting rows from entities.

Properties: The properties describe attributes and relationships of an entity.

Protocol: A protocol is an interface that declares methods without body.

Relationship: A relationship is established between two or more entities to explain how they are mutually associated to each other. The relationship can be of any type, To-One, To-Many, and Many to Many.

Snow Leopard: Mac OS X Snow Leopard is the most advanced operating system built on UNIX. It is an innovative, highly secure, compatible, and easy-to-use operating system.

SQLite: SQLite is a software library that implements a self-contained transactional SQL database engine. It has a small core and is much faster than other databases. It is also the most widely deployed SQL database engine in the world.

TableView: The TableView control is most popularly used to display information in a list format. It is also conveniently used to edit, delete, and insert new information.

Thread: A thread is an individual entity of execution. When a program runs, a thread is created and the operating system allocates processor time to it. A thread has its own individual set of code to be executed independently.

Transformable data type: The transformable data type is a custom data type used to create attributes based on any Objective-C class. It works with Value Transformers to store instance of UIColor, UIImage, and so on.

View: A View represents the user interface elements through which the user looks at the contents displayed by the application and can interact with.

Xcode: Xcode is a suite of tools for developing software on Mac OS X and for iOS, developed by Apple. It includes Apple's developer documentation and Interface Builder, an application used to construct graphical user interfaces.

XML files: Extensible Markup Language (XML) is a set of rules for encoding documents in machine-readable form. It was designed to describe data. It allows us to define our own tags.