Book Image

Core Data iOS Essentials

By : Bintu Harwani, B. M. Harwani
Book Image

Core Data iOS Essentials

By: Bintu Harwani, B. M. Harwani

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
About the Author
About the Reviewers

A brief history

The iPhone as we all know is an integrated cellular telephone and media player developed and marketed by Apple. It has become very popular in the past few years because of its amazing features. Looking at its huge number of users, developers around the world are attracted to develop applications for this unique device. Developers realized that besides games, there is a huge market of data applications for iPhone device. The attraction of creating data applications for iPhone device resulted into development of the Core Data framework. But the question is where did Core Data come from?

Core Data was first developed at NeXT Computer as the DBKit framework in 1992, which then became the Enterprise Object Framework (EOF) in 1994.

Enterprise Object Framework (EOF)

EOF is an object-relational mapping (ORM) framework that provides a mechanism for accessing the data as an object-oriented class structure. It is well-designed and encourages Model View Controller (MVC) design patterns. It also simplifies the tedious job of creating an application's data model. EOF is not just a framework, it is also a tool that helps in creating the application's data model visually — the task that was previously done by creating Objective-C classes. Besides this, the framework handles all the work involved in persisting the data to a SQL database, flat file, or any other data store. Based on object-oriented architecture, EOF is very flexible to use too. The roots of the Core Data framework come from the Enterprise Objects Framework (EOF).

Core Data

Core Data is part of the Cocoa API in Mac OS X first introduced with Mac OS X 10.4 Tiger and for the iOS with iPhone SDK 3.0. It is a powerful data model framework that was specifically designed to provide local data storage for Cocoa applications. The modeling functionality of Core Data is integrated right into XCode, so there's no need to switch back and forth between the IDE and modeler. With interface builder, it allows developers to quickly create a user interface (known as the views of the application in MVC terminology) without writing a single line of code. It is also the most effective solution to data persistence and allows us to persist our data to any number of different storage mediums, which includes storing data as XML, in binary files, or in an embedded SQLite database. The data modeling tool of Xcode allows us to define our application's data model graphically, which can be easily accessed through code. Instances of the entities defined in the data model are then managed by the Core Data framework and stored to a storage medium such as an XML file or SQLite database.

Now the question arises, what is Xcode and why we are using it for developing Core Data applications?

Why use Xcode?

Xcode is Apple's most comprehensive Software Development Kit (SDK), and it provides an environment for developing the applications for iPhone. It is a highly customizable integrated development environment (IDE) that includes compilers and applications, together with an extensive set of programming libraries and interfaces. It is a powerful source editor and a graphic debugger too. While developing applications with XCode, it gives us an option to enable a checkbox for enabling Core Data support. On selecting the checkbox, Xcode automatically creates code for us that make the task of developing core data applications quite easy.