Updated for Swift 4
Core Data
Core Data best practices by example, from persistency to multithreading and syncing.
by Florian Kugler and Daniel Eggert
Updated for Swift 3 and iOS 10/macOS10.12!
This book strives to give you clear guidelines for how to get the most out of Core Data while avoiding the pitfalls of this flexible and powerful framework. We start with a simple example app and extend it step by step as we talk about relationships, advanced data types, concurrency, syncing, and many other topics.
Later on, we go well beyond what’s needed for the basic example app. We'll discuss in depth how Core Data works behind the scenes, how to get great performance, the trade-offs between different Core Data setups, and how to debug and profile your Core Data code.
All code samples in this book are written in Swift. We show how you can leverage Swift’s language features to write elegant and safe Core Data code. We expect that you’re already familiar with Swift and iOS, but both newcomers and experienced Core Data developers will find a trove of applicable information and useful patterns.
Book Contents
-
Core Data and Swift
Leverage Swift’s language features to write elegant and safe Core Data code
-
Sample code
Browse a complete sample app, including CloudKit sync
-
Best Practices
Use efficient patterns to keep your code simple
-
Data Types
Use built-in and custom data types efficiently
-
Core Data Stacks
Understand the tradeoffs between different Core Data setups
-
Under the Hood
Gain detailed understanding of Core Data’s architecture
-
Concurrency
Understand when and how to use multiple contexts
-
Performance
Get great performance for your app
-
Memory Efficiency
Understand Core Data’s powerful mechanisms for efficient memory use
-
Syncing with Web-Services
Keep a local Core Data store in sync with data stored remotely
-
Profiling and Debugging
Diagnose performance and other issues
Formats & Extras
-
Code
-
Sample projects on GitHub
-
Written in Swift 4
-
-
Ebook
-
271-page PDF
-
Kindle and ePub
-
-
Paperback
-
316 pages
-
Also available in: Chinese
Buy Book
Bundles
Save on each additional book
About the Authors
-
Florian Kugler
Florian is one of the objc.io co-founders. He worked on Mac Apps like Deckset, co-authored the Thinking in SwiftUI book amongst others, and hosts the weekly Swift Talk video series. Recently, he also started running Anton Reisemobile part time, a workshop for fine campervan conversions.
-
Daniel Eggert
Daniel is one of the objc.io co-founders. He’s been working with all kinds of things related to Cocoa for more than 10 years – mostly photo and image processing. Daniel worked at Apple for five years and helped move Photos.app and Camera.app to Core Data.
FAQ
-
Is the book updated for Swift 4 and iOS 11/macOS 10.13?
Yes!
-
Will you update the book?
Yes, for more information on our policy, see book updates.
-
Do I need to have prior Core Data experience?
No, not at all. We expect you to be familiar with Swift and with programming on Apple’s platforms in general.
-
Does the book come with sample code?
Yes, the complete sample code is available on GitHub.
-
Do you offer student discounts?
Yes, please email us and let us know what and where you're studying.
-
Do you provide training?
Yes, we provide workshops and training. If you're interested, email us.
-
Can I get a “reverse charge” invoice without VAT?
Just click the "Generate Invoice" link in the receipt email and fill out your company data to get a VAT refund.
Updates
-
November 2017
Updated for Swift 4, iOS 11 and macOS 10.13
-
February 2017
Updated for Swift 3, iOS 10 and macOS 10.12
-
December 2015
Initial release
-
August 2015
Early access