<!--
{
  "availability" : [
    "iOS: 3.0.0 -",
    "iPadOS: 3.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.4.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreData",
  "identifier" : "/documentation/CoreData",
  "metadataVersion" : "0.1.0",
  "role" : "Framework",
  "symbol" : {
    "kind" : "Framework",
    "modules" : [
      "Core Data"
    ],
    "preciseIdentifier" : "CoreData"
  },
  "title" : "Core Data"
}
-->

# Core Data

Persist or cache data on a single device, or sync data to multiple devices with CloudKit.

## Overview

Use Core Data to save your application’s permanent data for offline use, to cache temporary data, and to add undo functionality to your app on a single device. To sync data across multiple devices in a single iCloud account, Core Data automatically mirrors your schema to a CloudKit container.

Through Core Data’s Data Model editor, you define your data’s types and relationships, and generate respective class definitions. Core Data can then manage object instances at runtime to provide the following features.

### Persistence

Core Data abstracts the details of mapping your objects to a store, making it easy to save data from Swift and Objective-C without administering a database directly.

![Flow diagram showing an app saving data to and loading data from a persistent store.](images/com.apple.coredata/media-3119932@2x.png)

### Undo and redo of individual and batched changes

Core Data’s undo manager tracks changes and can roll them back individually, in groups, or all at once, making it easy to add undo and redo support to your app.

![Figure showing a shake to undo gesture causing an element to be removed from a list.](images/com.apple.coredata/media-3118362@2x.png)

### Background data tasks

Perform potentially UI-blocking data tasks, like parsing JSON into objects, in the background. You can then cache or store the results to reduce server roundtrips.

![Flow diagram showing data from an endpoint populating objects in the background before updating the UI.](images/com.apple.coredata/media-3118359@2x.png)

### View synchronization

Core Data also helps keep your views and data synchronized by providing data sources for table and collection views.

### Versioning and migration

Core Data includes mechanisms for versioning your data model and migrating user data as your app evolves.

## Topics

### Essentials

[Creating a Core Data model](/documentation/CoreData/creating-a-core-data-model)

Define your app’s object structure with a data model file.

[Setting up a Core Data stack](/documentation/CoreData/setting-up-a-core-data-stack)

Set up the classes that manage and persist your app’s objects.

[Core Data stack](/documentation/CoreData/core-data-stack)

Manage and persist your app’s model layer.

[Handling Different Data Types in Core Data](/documentation/CoreData/handling-different-data-types-in-core-data)

Create, store, and present records for a variety of data types.

[Linking Data Between Two Core Data Stores](/documentation/CoreData/linking-data-between-two-core-data-stores)

Organize data in two different stores and implement a link between them.

### Data modeling

[Modeling data](/documentation/CoreData/modeling-data)

Configure the data model file to contain your app’s object graph.

[Core Data model](/documentation/CoreData/core-data-model)

Describe your app’s object structure.

### Fetch requests

Core Data retrieves persisted data to be used by your app.

[`NSFetchRequest`](/documentation/CoreData/NSFetchRequest)

A description of search criteria used to retrieve data from a persistent store.

[`NSAsynchronousFetchRequest`](/documentation/CoreData/NSAsynchronousFetchRequest)

A fetch request that retrieves results asynchronously and supports progress notification.

[`NSAsynchronousFetchResult`](/documentation/CoreData/NSAsynchronousFetchResult)

A fetch result object that encompasses the response from an executed asynchronous fetch request.

[`NSFetchedResultsController`](/documentation/CoreData/NSFetchedResultsController)

A controller that you use to manage the results of a Core Data fetch request and to display data to the user.

### SwiftData migration and coexistence

[Adopting SwiftData for a Core Data app](/documentation/CoreData/adopting-swiftdata-for-a-core-data-app)

Persist data in your app intuitively with the Swift native persistence framework.

### CloudKit mirroring

[Mirroring a Core Data store with CloudKit](/documentation/CoreData/mirroring-a-core-data-store-with-cloudkit)

Back user interfaces with a local replica of a CloudKit private database.

[Synchronizing a local store to the cloud](/documentation/CoreData/synchronizing-a-local-store-to-the-cloud)

Share data between a user’s devices and other iCloud users.

[`NSPersistentCloudKitContainer`](/documentation/CoreData/NSPersistentCloudKitContainer)

A container that encapsulates the Core Data stack in your app, and mirrors select persistent stores to a CloudKit private database.

[`NSPersistentCloudKitContainerOptions`](/documentation/CoreData/NSPersistentCloudKitContainerOptions)

An object that customizes how a store description aligns with a CloudKit database.

[Sharing Core Data objects between iCloud users](/documentation/CoreData/sharing-core-data-objects-between-icloud-users)

Use Core Data and CloudKit to synchronize data between devices of an iCloud user and share data between different iCloud users.

### Change processing

[Accessing data when the store changes](/documentation/CoreData/accessing-data-when-the-store-changes)

Guarantee that a context won’t see store changes until you tell it to look.

[Consuming relevant store changes](/documentation/CoreData/consuming-relevant-store-changes)

Filter store transactions for changes relevant to the current view.

[Persistent history](/documentation/CoreData/persistent-history)

Use persistent history tracking to determine what changes have occurred in the store since the enabling of persistent history tracking.

### Background tasks

[Using Core Data in the background](/documentation/CoreData/using-core-data-in-the-background)

Use Core Data in both a single-threaded and multithreaded app.

  <doc://com.apple.documentation/documentation/SwiftUI/loading-and-displaying-a-large-data-feed>

[Conflict resolution](/documentation/CoreData/conflict-resolution)

Detect and resolve conflicts that occur when data is changed on multiple threads.

[Batch processing](/documentation/CoreData/batch-processing)

Use batch processes to manage large data changes.

### Data model migration

Core Data has built-in data migration tools to help synchronize your app’s data with the current data model.

[Migrating your data model automatically](/documentation/CoreData/migrating-your-data-model-automatically)

Enable lightweight migrations to keep your data model and the underlying data in a consistent state.

[Staged migrations](/documentation/CoreData/staged-migrations)

Migrate complex data models containing changes that are incompatible with lightweight migrations.

[Manual migrations](/documentation/CoreData/manual-migrations)

Migrate elaborate data models with changes that go beyond the capabilities of both lightweight and staged migrations.

### Related types

[Core Data Constants](/documentation/CoreData/core-data-constants)

Keys to use with persistent stores and notifications from Core Data.

### Macros

[Macros](/documentation/CoreData/CoreData-macros)



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)