Introduction - Pro iOS Persistence: Using Core Data (2014)

Pro iOS Persistence: Using Core Data (2014)


The world has gone mobile, and it seems that iOS apps lead the charge. People use their iPhone, iPads, and soon their Apple Watches to consume, produce, and store a diversity of information. As you develop applications to run on these Apple devices, you’ll appreciate the polish that Apple has spread on its persistence framework: Core Data. No other mobile platform offers a persistence layer that approaches Core Data’s power, ease of use, or flexibility. With each release of the iOS Software Development Kit (SDK), Apple grows and improves the Core Data framework.

We’ve written and rewritten this book several times as Core Data has continued to grow. Last summer, as we neared completion of this book, Apple surprised us all with the announcement of its new Swift programming language. After discussion between ourselves and with the folks at Apress, we concluded that the proper response to Swift’s advent was to rewrite anew and incorporate every example in this book in both Objective-C and Swift. We have some bruises and scars from that experience, of course, as all the Swift early adopters can attest. With each new release of Xcode, we had to revisit chapters we thought done because some bits of code no longer compiled under the new Xcode. We believe we’ve caught all the errant ?s and !s, but apologize in advance if any slipped through.

What You’ll Need

To follow along with this book, you’ll need a Mac running OS X Mavericks or OS X Yosemite, and you’ll need Xcode 6. You’ll be happiest if you’re running the latest point version of Xcode 6, particularly if you use the Swift code samples. Language support for Swift continues to improve with each release of Xcode. You can download the latest version of Xcode 6 from the Mac App Store.

This text doesn’t cover beginning iOS development, whether in Objective-C or Swift, so you should have at least a basic understanding of either Objective-C or Swift, and also of Cocoa Touch and iOS development.

What You’ll Find

This book approaches iOS persistence and Core Data from both theoretical and practical perspectives, so you’ll learn generally how Core Data works and how its pieces fit together, and also you’ll be guided step-by-step how to incorporate this powerful persistence framework into your applications. You’ll see how to implement every topic we treat both in Objective-C and in Swift. We cover a range of topics, including how to build your Core Data data models, how to query your data, how to migrate data across model versions, how to encrypt data, how to use Core Data on different threads, how to store data in the cloud, and how to tune performance.

You can read the book cover to cover, but for the best results we recommend you read it in front of your computer, typing in the code samples to understand how they work and what they do. We also recommend that you keep this book as a reference for your ongoing Core Data needs and challenges.

How This Book Is Organized

We’ve organized this book to build from basic principles to advanced topics, so you’ll probably gain the most if you work through the book from front to back. Chapter titles clearly mark the subject matter they contain, however, so if you’re looking for information on a specific topic, feel free to jump directly to that chapter.