Author(s): Florian Kugler, Daniel Eggert
Edition: 2nd Edition
Publisher: objc.io
Year: 2016
Language: English
Pages: 271
Introduction......Page 1
How This Book Approaches Core Data......Page 9
A Note on Swift......Page 11
Part 1: Core Data Basics......Page 12
Hello Core Data......Page 14
Core Data Architecture......Page 16
Data Modeling......Page 17
Setting Up the Stack......Page 20
Showing the Data......Page 22
Manipulating Data......Page 30
Summary......Page 36
Notes for Pre-iOS 10/macOS 10.12......Page 37
Relationships......Page 38
Adding More Entities......Page 40
Subentities......Page 43
Creating Relationships......Page 46
Other Types of Relationships......Page 48
Establishing Relationships......Page 50
Relationships and Deletion......Page 54
Adapting the User Interface......Page 57
Data Types......Page 59
Standard Data Types......Page 61
Primitive Properties and Transient Attributes......Page 63
Custom Data Types......Page 64
Default Values and Optional Values......Page 71
Summary......Page 72
Part 2: Understanding Core Data......Page 73
Accessing Data......Page 75
Fetch Requests......Page 76
Relationships......Page 85
Other Ways to Retrieve Managed Objects......Page 86
Memory Considerations......Page 87
Summary......Page 89
Changing and Saving Data......Page 90
Change Tracking......Page 92
Saving Changes......Page 94
Batch Updates......Page 99
Summary......Page 101
Performance......Page 102
Performance Characteristics of the Core Data Stack......Page 104
Avoiding Fetch Requests......Page 108
Optimizing Fetch Requests......Page 116
Inserting and Changing Objects......Page 123
How to Build Efficient Data Models......Page 124
Part 3: Concurrency and Syncing......Page 128
Syncing with a Network Service......Page 130
Organization and Setup......Page 131
Syncing Architecture......Page 133
Context Owner......Page 134
Reacting to Local Changes......Page 137
Reacting to Remote Changes......Page 141
Change Processors......Page 142
Deleting Local Objects......Page 145
Groups and Saving Changes......Page 146
Expanding the Sync Architecture......Page 147
Working with Multiple Contexts......Page 150
Concurrency Rules......Page 152
Merging Changes......Page 158
The Default Concurrent Setup......Page 159
Setups with Multiple Coordinators......Page 161
Setups with Nested Contexts......Page 163
Complexity of Nested Contexts......Page 167
Summary......Page 172
Problems with Multiple Contexts......Page 173
Save Conflicts and Merge Policies......Page 175
Query Generations......Page 181
Deleting Objects......Page 183
Uniqueness Constraints......Page 187
Summary......Page 189
Part 4: Advanced Topics......Page 190
Predicates......Page 192
Simple Predicates......Page 193
Format Strings......Page 195
Combining Predicates......Page 199
Traversing Relationships......Page 201
Matching Objects and Object IDs......Page 203
Matching Strings......Page 204
Transformable Values......Page 206
Performance and Ordering Expressions......Page 207
Text......Page 208
The Complexity of Unicode......Page 210
Searching......Page 211
Sorting......Page 215
Model Versions and Migrating Data......Page 220
Model Versions......Page 222
The Migration Process......Page 225
Inferred Mapping Models......Page 234
Custom Mapping Models......Page 235
Migration and the UI......Page 240
Testing Migrations......Page 241
Profiling......Page 243
SQL Debug Output......Page 245
Core Data Instruments......Page 252
Summary......Page 256
Relational Database Basics and SQL......Page 257
An Embedded Database......Page 259
Tables, Columns, and Rows......Page 260
Architecture of the Database System......Page 261
The Database Language SQL......Page 264
Relationships......Page 266
Indexes......Page 269
Journaling......Page 270
Summary......Page 271