Book Image

Objective C Memory Management Essentials

Book Image

Objective C Memory Management Essentials

Overview of this book

Table of Contents (18 chapters)
Objective-C Memory Management Essentials
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Putting it into practice


Now that we have covered the basics of Core Data, let's proceed with some code examples of how to use Core Data, where we use Core Data to store customer details in a Customer table. The information we want to store is:

  • name

  • email

  • phone_number

  • address

  • age

Note

Do note that all attribute names must be in lowercase and should not have spaces in them. For example, we will use Core Data to store customer details mentioned earlier as well as retrieve, update, and delete the customer records using the Core Data framework and methods.

  1. First, we will select File | New | File and then select iOS | Core Data:

  2. Then, we will proceed to create a new Entity called Customer by clicking on the Add Entity button in the bottom left of the screen, as shown here:

  3. Then, we will proceed to add in the attributes for our Customer entity and give them the appropriate Type, which can be String for attributes such as name or address and Integer 16 for age:

  4. Lastly, we need to add CoreData.framework...