Fact-checked by Grok 2 weeks ago

Core Data

Core Data is a robust provided by Apple for , , macOS, , and applications, designed to manage the model layer by handling object graph persistence, caching, and synchronization across devices via and CloudKit. It abstracts complex data storage tasks, such as into XML, binary, or formats, while enabling features like undo/redo functionality, validation, and efficient querying without requiring developers to write low-level database code. Originating from the Enterprise Objects Framework (EOF) developed by NeXT for web applications, Core Data was adapted and introduced by Apple in Mac OS X 10.4 Tiger in 2005, with iOS support added in iPhone SDK 3.0 in 2009. This evolution positioned it as a mature solution for data-driven apps, reducing by 50-70% through automated solutions for common tasks like change tracking, , and . Key components include the managed object model for defining entities and relationships via a visual editor, the managed object context for tracking changes and ensuring , the persistent store coordinator for coordinating data storage, and integration with NSFetchedResultsController for -specific UI updates in table and collection views. Core Data excels in scenarios requiring complex data relationships, offline access, and cross-device syncing, supporting background processing to avoid blocking the during intensive operations like import or JSON parsing. It enforces through built-in validation rules and referential constraints, while versioning tools allow seamless migration of data across app updates without loss. Although powerful, it operates on a thread-confined model, requiring careful of contexts to prevent concurrency issues, and has inspired newer frameworks like SwiftData for simplified Swift-based development.

Fundamentals

Overview and Purpose

Core Data is an object graph management and provided by Apple for developing applications on its operating systems. It enables developers to manage the model layer in object-oriented apps by handling the lifecycle of objects, including creation, validation, and maintenance of relationships between entities, while ensuring through built-in validation rules. The primary purpose of Core Data is to offer a high-level over underlying mechanisms, allowing developers to persist, query, and retrieve without writing SQL or managing low-level database operations directly. Instead, it uses declarative predicates for querying and automates persistence tasks, such as saving changes to disk-based stores like or binary formats. This simplifies , reducing the amount of needed for model handling by 50-70% in typical scenarios. Core Data supports multiple Apple platforms, including macOS starting from version 10.4 Tiger, and from version 3.0, from version 9.0, from version 2.0, and from version 1.0. Key benefits include robust undo and redo functionality that tracks changes at the object level for easy reversal, faulting mechanisms for efficient usage by loading data , and seamless integration with Apple's broader ecosystem, such as CloudKit for synchronization and UI frameworks like or UIKit for view updates. At a high level, the workflow involves defining a once using Xcode's graphical editor to specify entities, attributes, and relationships, after which developers can fetch, update, and persist objects through managed object contexts without concerning themselves with storage details. This approach facilitates building data-driven applications that maintain consistency across user interactions and device states.

Core Components

Core Data's architecture revolves around a set of interconnected components that manage the object graph, ensuring efficient data persistence, retrieval, and manipulation in applications across Apple's platforms (iOS, macOS, tvOS, watchOS, and visionOS). These components form the "Core Data stack," which abstracts the complexities of data storage while providing a flexible framework for developers. At its core, the stack includes the managed object model for schema definition, the persistent store coordinator for store management, the managed object context for runtime operations, and the managed object for data representation, with the persistent container serving as a modern wrapper to streamline their integration. The NSManagedObjectModel serves as the foundational schema for the application's , encapsulating entities, attributes, and relationships that define the types of objects Core Data will manage. It is typically created and edited using Xcode's integrated editor, which compiles the model into a representation for use in the application. This model enables Core Data to map persistent store records to managed objects, supporting features like validation and relationships without requiring manual definitions. The NSPersistentStoreCoordinator acts as the central mediator between the managed object model and one or more underlying persistent stores, such as databases or XML files. It handles the loading, addition, and removal of stores, while also managing data migrations between different store versions or formats to maintain compatibility during app updates. By abstracting store-specific details, the coordinator ensures that the rest of the stack operates independently of the physical storage mechanism, allowing developers to switch backends without altering application logic. The NSManagedObjectContext provides a scratchpad-like environment for working with managed objects on a specific thread, tracking insertions, updates, deletions, and relationships to maintain the integrity of the . It supports and redo functionality by recording changes in a reversible manner and coordinates with the persistent store coordinator to fetch data from stores or commit modifications back to them. Each context operates within a concurrency type—such as main queue for UI-related tasks or private queue for background processing—to prevent threading conflicts, ensuring safe manipulation of objects during runtime. NSManagedObject is the base class for all entity instances in Core Data, representing individual records as objects that conform to the Key-Value Coding and Key-Value Observing protocols. Developers can subclass it to add custom logic, such as computed properties or validation rules, while inheriting built-in behaviors for faulting (), change tracking, and relationship management. This class ensures that objects remain synchronized with their persistent store counterparts, firing notifications for changes that can trigger updates or other app responses. Introduced in iOS 10.0 and macOS 10.12, the NSPersistentContainer offers a high-level abstraction that automates the setup of the entire Core Data stack by instantiating and configuring an NSManagedObjectModel, NSPersistentStoreCoordinator, and NSManagedObjectContext in a single object. It simplifies common tasks like loading the default persistent store and provides a convenient view context for UI integration, reducing while maintaining access to lower-level components for advanced customization. These components interact in a layered flow to manage data lifecycle: the NSManagedObjectContext performs fetches and queries through the NSPersistentStoreCoordinator, which in turn accesses the underlying persistent stores based on the schema defined in the NSManagedObjectModel. Changes made to NSManagedObject instances within a context are validated locally before being committed to the coordinator, which propagates them to the stores; the NSPersistentContainer orchestrates this process transparently, ensuring efficient across the . This design promotes , allowing isolated testing of contexts or coordinators while supporting scalable object operations.

Usage and Implementation

Data Modeling

Data modeling in Core Data involves defining the structure of an application's data using a visual editor in , which generates a model file that describes entities, their attributes, and relationships. This schema serves as the foundation for the managed object model, represented by the NSManagedObjectModel class, enabling Core Data to handle object graph management and . The process begins with creating a .xcdatamodeld file, 's bundle format for Core Data models, which can be added to a new project by selecting the "Use Core Data" option during setup or to an existing project via File > New > File > Core Data > Data Model. Entities in Core Data represent the classes of objects in the app's model layer, inheriting from NSManagedObject to provide features like change tracking and validation. Each is configured in the model editor by adding it through the "Add Entity" button and specifying its name, with options for such as automatic class definition or manual subclasses. Attributes define the properties of an entity, supporting scalar types like integers (Int16, Int32, Int64), floating-point numbers (, ), strings (), dates (), booleans (), and binary data (), as well as transformable types for custom . For example, an entity named "Employee" might include attributes such as name (), hireDate (), and salary (), ensuring type-safe access in code. Relationships establish connections between , supporting to-one () for singular references, to-many (one-to-many) for collections of related objects, and fetched properties for derived sets based on fetch requests. In the model editor, relationships are added by control-dragging in the graph view or via the , specifying the destination , , and whether the to-many is ordered. are mandatory to maintain , automatically propagating changes bidirectionally; for instance, an "Employee" 's (to-one) would inverse to a "Department" 's employees (to-many). Delete rules enforce : nullify removes the reference without deleting the target, cascade deletes the target objects, deny prevents deletion if targets exist, and no action leaves dangling references requiring manual handling. Constraints and validations ensure data quality, with unique identifiers set on one or more attributes (e.g., a comma-separated list like "email,username") to prevent duplicates during inserts, using merge policies like mergeByPropertyObjectTrump for conflict resolution. Core Data supports basic validation rules on attributes, such as required fields or value ranges, enforced at save time. Entity inheritance allows for polymorphic models, where child entities inherit attributes and relationships from a parent entity, configurable by setting the "Parent Entity" in the entity inspector. Abstract entities, marked via the "Abstract" checkbox, serve as base classes that cannot be instantiated directly but provide shared structure for subclasses; for example, an abstract "Vehicle" entity with common attributes like registrationNumber (String) could be inherited by concrete entities "Car" and "Truck" for specialized properties. This promotes code reuse and supports queries across subclasses using the abstract entity as the fetch entity. To handle schema evolution, Core Data supports migrations between model versions created by duplicating the .xcdatamodeld file and incrementing its version. Lightweight migrations, the default for compatible changes like adding removable attributes or non-breaking relationship updates, use inferred mapping models generated automatically by Core Data to transform data without custom code. Heavyweight migrations, required for complex changes like attribute renaming or splitting entities, involve explicit mapping models defining value expressions and entity mappings, often with custom migration policies subclassing NSEntityMigrationPolicy. Developers enable automatic lightweight migration by setting options on the persistent store coordinator, such as NSMigratePersistentStoresAutomaticallyOption to true. Best practices for Core Data modeling emphasize to minimize , such as avoiding duplicate attributes across entities by leveraging relationships instead of denormalized data copies, which reduces needs and update anomalies. Derived properties, implemented as fetched properties or transient attributes computed at , should be used for values calculable from other data, like a fullName derived from firstName and lastName, to keep the model lean; however, for performance-critical derivations, prefer fetch requests with predicates over complex transient logic. Always define inverses and appropriate delete rules to prevent orphaned objects, and use constraints for uniqueness to maintain without checks.

CRUD Operations

Core Data provides a set of runtime operations for managing data through the (CRUD) paradigm, primarily orchestrated via the NSManagedObjectContext class, which acts as a workspace for in-memory changes before they are persisted. These operations leverage the framework's object graph to ensure , with changes tracked automatically until explicitly saved to the underlying persistent store. The process emphasizes efficient querying and modification while integrating with Core Data's validation and mechanisms to handle errors and reversals. To create new data objects, developers use NSEntityDescription to instantiate NSManagedObject instances and insert them into a managed object context. For example, the method insertNewObject(forEntityName:into:) on NSEntityDescription creates an instance of the specified entity and registers it for insertion in the provided context, simplifying the process without manual entity resolution. Alternatively, NSManagedObject can be initialized directly with init(entity:insertInto:), passing the entity's description and the target context, which immediately inserts the object into the graph for tracking. This insertion does not persist data until a save operation is performed, allowing batch creations within the same context. Reading data involves constructing an NSFetchRequest to query the persistent store through the context, retrieving managed objects that match specified criteria. The request can include an NSPredicate for filtering, such as "age > 18 AND name CONTAINS 'John'", which evaluates conditions on attributes and relationships to narrow results efficiently at the database level. For , NSSortDescriptor objects are added to the request's sortDescriptors array, enabling ordered results like ascending by name or descending by date. is supported via the fetchBatchSize property, which limits fetched objects to batches (e.g., 20 at a time) to optimize memory usage for large datasets, with fetchLimit capping the total count. Complex queries combine predicates using NSCompoundPredicate, such as NSCompoundPredicate(andPredicateWithSubpredicates:) for AND logic or orPredicateWithSubpredicates: for OR conditions, allowing sophisticated filtering without custom SQL. For scenarios requiring dynamic updates in table or collection views, NSFetchedResultsController wraps an NSFetchRequest to monitor changes and provide sectioned, sorted results, though it remains tied to the underlying fetch mechanics. Updating existing objects entails direct modification of their attributes or relationships within the context, as NSManagedObject instances behave like standard Objective-C or Swift objects with key-value coding support. Changes to properties, such as setting object.name = "Updated Name", are automatically tracked by the context, which exposes a hasChanges property to detect any modifications, insertions, or deletions since the last save. Relationship updates, like adding or removing objects from to-many relationships, propagate through the graph while respecting inverse relationships defined in the model. Validation rules, such as constraints on attribute values, are enforced during saves but can be checked preemptively via the object's validateValue:forKey:error: method. Deletion removes objects from the and, upon , from the persistent using context.delete(object), which marks the instance for removal and updates related objects accordingly. For to-many relationships, the removeFromRelationship or equivalent mutators can first detach the object before deletion to maintain consistency, though delete handles most cases directly. Bulk deletions are possible with NSBatchDeleteRequest, which executes at the store level (e.g., SQL DELETE) for efficiency on large sets, returning a result with the count of affected objects. Deleted objects are added to the context's deletedObjects set for monitoring, but they are no longer accessible post-save. All CRUD changes accumulate in the until committed via the save() , which propagates modifications to the persistent store coordinator and underlying stores, performing validation and merging if multiple contexts are involved. If validation fails—due to violations or mismatches—the returns an NSError detailing the issue, allowing developers to handle conflicts like duplicate unique attributes. The save process is for the 's changes, ensuring , and can be invoked asynchronously in background contexts to avoid blocking the main thread. Successful saves clear the 's change tracking, resetting hasChanges to false. Core Data includes built-in undo support through the context's undoManager property, an instance of NSUndoManager that records insertions, updates, deletions, and relationship changes as reversible actions. Enabling it—by assigning a shared or dedicated undo manager—allows calls like context.undo() to revert the last change or a group, with redo() for forward steps and undoNestedGroup() for batched operations. This integrates seamlessly with app-level undo, such as menu items, and automatically groups changes within the same run loop unless disabled via processPendingChanges(). Developers can limit undo depth or disable it entirely for performance in non-interactive contexts, reducing memory overhead from retained objects.

UI Framework Integrations

Core Data integrates with Apple's UI frameworks to enable data-driven interfaces that automatically reflect changes in the underlying model, ensuring synchronization between the persistent store and user-facing elements. In legacy macOS applications, Cocoa Bindings provide a declarative way to connect Core Data fetched results to UI components, primarily through controllers like NSArrayController. This controller manages an array of managed objects fetched from a managed object context, supporting features such as automatic content preparation upon loading, predicate-based filtering for dynamic queries (e.g., filtering employees by name using ANY employees.firstName like 'Matthew'), and options like "Deletes Objects On Remove" for handling relationship deletions. Bindings to NSArrayController's arrangedObjects or content properties allow table views or other UI elements to update automatically when data is inserted, deleted, or modified in the context, without manual intervention. Interface Builder in Xcode facilitates seamless integration by allowing developers to drag entities from the Core Data model editor directly into storyboards or XIB files, auto-generating controller instances such as NSArrayController or NSObjectController configured with the appropriate entity and fetch predicates. This visual setup establishes bindings between the model and elements like table views or forms, streamlining the creation of data-bound interfaces while ensuring the controllers reference the correct managed object context for fetches and updates. For UIKit-based applications, particularly those using table or collection views, NSFetchedResultsController serves as a key integration point, managing fetch request results and notifying the of changes via its delegate , NSFetchedResultsControllerDelegate. The delegate methods, such as controllerWillChangeContent(_:) and controller(_:didChange:atIndexPath:for:), enable granular updates to UITableView or UICollectionView instances—inserting, deleting, moving, or updating rows/sections in response to Core Data modifications—while minimizing performance overhead by diffing changes efficiently. This approach is especially useful for hierarchical or large datasets, as it supports sectioning and sorting descriptors to organize data for display. Since and macOS 11, offers native, declarative integration with Core Data through the @FetchRequest property wrapper, which wraps an NSFetchRequest to provide a reactive FetchedResults collection directly in views, automatically updating the UI when the underlying data changes. Views conforming to ObservableObject or using @StateObject can observe these fetches, enabling reactive patterns where, for example, a List displays managed objects fetched by entity name, , and sort , with changes propagated via the view context. Additionally, NSFetchRequest can be used as a property wrapper for more customized reactive behaviors in ObservableObject-based view models. As of 2025, best practices for Core Data in emphasize its declarative paradigm by combining @FetchRequest with background managed object to perform non-blocking operations, such as imports or complex queries, ensuring the main UI thread remains responsive. Developers should create child with NSPrivateQueueConcurrencyType for background tasks, merge changes back to the view using mergePolicy like NSMergeByPropertyObjectTrump, and leverage notifications or perform scheduling to refresh @FetchRequest results without freezing the interface. This approach aligns with SwiftUI's , avoiding direct manipulation in views. Enhancements in and later, building on 5.5's concurrency model, provide support for async/await in Core Data operations, including asynchronous fetches via perform(_:) on NSManagedObjectContext, which allows UI threads to await results without blocking. This enables safer, more efficient code in views, such as using Task { await context.perform { fetchRequest.execute() } } for non-UI-blocking data retrieval, reducing thread explosion risks and integrating seamlessly with patterns like actors for context isolation. In iOS 18, further simplifications optimize async Core Data operations with improvements to perform and NSManagedObjectContext.

Persistence Options

Local Storage Formats

Core Data supports several local persistence formats for storing managed object data on disk, enabling offline access and efficient querying within and macOS applications. These formats include the default store, as well as and XML options, each optimized for different data sizes, performance needs, and development workflows. Additionally, developers can implement custom stores by subclassing NSPersistentStore to support proprietary or specialized backends. The store, identified by the constant NSSQLiteStoreType, serves as the default local storage format in Core Data. It leverages a backend, automatically generating the from the application's to support complex queries via predicates and sorting. This format excels with large datasets, offering high performance through indexing and partial object graph loading into memory, while supporting byte-range locking on file systems like HFS+ for concurrent access. It is particularly suited for production applications requiring robust and , though it imposes limitations such as no support for Cocoa-based sorting on transient properties or certain to-many key paths in predicates. For scenarios involving smaller, non-relational datasets, the binary store (NSBinaryStoreType) provides a compact, storage option in a single file. This format stores the entire object graph in before writing to disk, ensuring fast saves and reads without the overhead of relational structures. It is ideal for applications needing quick, all-or-nothing , such as archiving simple object collections, but offers lower and no built-in optimizations for very large data volumes. The XML store (NSXMLStoreType), available on macOS but not , uses a human-readable format for portability and ease of inspection during development. Like the binary store, it operates atomically with the full object in , making it suitable for simple, small-scale stores that benefit from external or . However, its degrades with larger datasets due to overhead, and it provides minimal security features, positioning it primarily for prototyping rather than deployment. Custom stores, introduced with macOS 10.5, allow developers to extend Core Data by subclassing NSPersistentStore for with backends, such as ODBC or in-memory simulations. These custom implementations can handle proprietary formats while adhering to Core Data's save and load protocols, enabling scenarios like hybrid local-remote persistence without altering the core framework. Documentation for and incremental store programming provides guidance on creating such extensions. Store configuration in Core Data occurs through the persistent store coordinator, which can manage multiple stores simultaneously for segmented data handling, such as separating user preferences from core app data. Stores are loaded via URL paths and explicitly specified types (e.g., NSSQLiteStoreType), with options for metadata querying and type overrides to tailor behavior per store. This flexibility supports diverse architectures, like using for primary data and binary for caches. Migration between local storage formats is facilitated by models that define transformations between versions, allowing seamless transitions such as from XML to . The persistent store coordinator's migratePersistentStore:toURL:options:withType:error: method handles the process by creating a temporary stack, loading objects, and reassigning identifiers, ensuring during format changes or store relocations.

Cloud Synchronization

Core Data provides cloud synchronization capabilities through integration with CloudKit, Apple's backend service for iCloud data storage and syncing across devices. Introduced in and macOS 10.15, this feature enables automatic mirroring of local Core Data persistent stores to CloudKit databases, allowing seamless multi-device access for users signed in with the same account. The primary mechanism for this integration is NSPersistentCloudKitContainer, a subclass of NSPersistentContainer that extends the standard Core Data stack to handle CloudKit operations transparently. This container manages the export of local changes to CloudKit and the import of remote updates, building on local persistent stores such as or binary formats for offline functionality. Developers initialize it similarly to NSPersistentContainer but with added options for CloudKit configuration, ensuring that data models are automatically adapted for cloud compatibility without requiring custom schema definitions. To set up , developers enable the in Xcode's Signing & Capabilities for their , which automatically adds the necessary entitlements file with a CloudKit container identifier matching the . No manual schema deployment to CloudKit is required, as the system handles initial and ongoing mirroring upon first launch. For , enabling the Remote Notifications ensures the app receives push notifications for incoming changes even when not active. The process operates bidirectionally: local modifications to managed objects are exported as changes to a private CloudKit database by default, using persistent history tracking to identify only what has changed since the last . Remote changes from other devices are imported via system-scheduled operations, triggered by CloudKit notifications or , and merged into the local store. Conflicts during import are resolved using a last-write-wins based on timestamps, though developers can implement custom merge policies via NSMergePolicy for more complex scenarios. This process fully supports relationships, fetched , and deletions, preserving across sync cycles. Key features include automatic background syncing managed by system daemons like cloudd, which minimizes battery impact by processing changes opportunistically, such as during charging or availability. NSPersistentHistoryTracking is enabled by default, providing change tokens that track transaction for efficient exports and imports, reducing usage. For shared data scenarios, public CloudKit zones can be configured via NSPersistentCloudKitContainerOptions to allow read access without authentication, though writes remain private. Limitations include a mandatory account for private database access, restricting synchronization to the signed-in user's devices; public zones support read-only sharing by default, with private data isolated per user. Syncing may experience delays due to conditions or system throttling, and it requires compatible data models without certain unsupported attributes like exceeding CloudKit limits. In and later (specifically iOS 17.4+), enhancements include improved support for Core Data objects between different users via CloudKit shared zones, with better error handling through detailed completion handlers in APIs like share(_:to:completion:). Additionally, integration with has been refined to leverage remote change notifications (e.g., .NSPersistentStoreRemoteChange) for real-time UI updates during sync, using persistent history transactions to refresh views efficiently without manual polling. These updates, available from 2023 onward, address previous limitations in collaborative scenarios and provide more robust via enhanced in tools like the CloudKit Console.

Development History

Origins and Evolution

Core Data's conceptual foundations originated with the Enterprise Objects Framework (EOF), developed by NeXT starting in 1992 as an initial iteration known as DatabaseKit to simplify database access in object-oriented applications. By the early , EOF had evolved into a comprehensive object-relational mapping system designed for enterprise database applications, enabling developers to model data as objects while handling persistence, relationships, and queries against relational databases like or Sybase. Central to EOF's architecture were innovations like object faulting, which used placeholder objects to defer data loading until access was needed, thereby optimizing memory and performance; editing contexts, which managed object graphs, tracked changes, and supported nested for concurrent edits; and the EOFetchSpecification query mechanism, a qualifier-based system for fetching and ordering objects that prefigured Core Data's NSPredicate for declarative filtering. These elements allowed EOF to abstract complex database operations, ensuring object uniqueness via global identifiers and supporting features like mapping and validation, all while integrating seamlessly with NeXT's environment. Apple's acquisition of NeXT in February 1997 brought EOF into the ecosystem, where it was initially ported to support WebObjects for server-side development but later streamlined into Core Data to prioritize local, file-based persistence over distributed enterprise database connectivity. This simplification addressed the needs of and emerging applications by reducing dependencies on external databases and focusing on efficient object graph management. The evolution in design philosophy marked a shift from EOF's emphasis on robust, multi-user database synchronization to Core Data's lightweight approach, which treats the persistent store as an opaque backend—often XML, binary, or —for single-device scenarios, while retaining core abstractions like faulting and contexts for undoable, MVC-integrated data handling. Key contributors to this transition included members of Apple's engineering team during the Mac OS X development phase (late 1990s to early 2000s), who adapted EOF's principles to align with Cocoa's model-view-controller paradigm, ensuring seamless integration with interface builders and document-based architectures.

Major Releases and Updates

Core Data was first introduced in Mac OS X 10.4 Tiger in 2005, providing developers with a basic persistence stack that included support for SQLite as the default store format. This release established Core Data as a managed object framework for object graph management and data persistence on macOS. The framework expanded to mobile platforms with its debut in iPhone OS 3.0 (later renamed ) in 2009, enabling offline data storage and undo functionality in iOS apps. Key milestones followed, including the addition of support for custom persistent stores in Mac OS X 10.5 in 2007, which allowed developers to integrate alternative data formats beyond the built-in options. In 2016, introduced NSPersistentContainer, a high-level class that simplified Core Data stack setup by automating the creation of the managed object model, context, and store coordinator. CloudKit integration arrived in in 2019 via NSPersistentCloudKitContainer, facilitating automatic synchronization of Core Data stores with across devices. Post-2020 updates focused on enhancing integration with modern Swift and UI paradigms. iOS 14 in 2020 added SwiftUI support through the @FetchRequest property wrapper, allowing declarative fetching of Core Data objects directly in views for reactive updates. In iOS 15 (2021), enhancements to persistent history tracking via NSPersistentHistoryChange improved efficient syncing by enabling selective application of changes to view contexts, reducing unnecessary data processing. iOS 15 in 2021 introduced native async/await support for operations like fetching and saving, leveraging Swift concurrency for safer and more efficient asynchronous code. From 2023 to 2025, Apple introduced at WWDC 2023 as a declarative persistence layer built atop , optimized for apps with simpler modeling via plain types. itself faced no , remaining recommended for complex data management scenarios requiring advanced features like custom migrations. As of 2025, is fully integrated into 16 and later, with ongoing performance optimizations tailored for architectures to leverage unified memory and improved CPU efficiency.

References

  1. [1]
    Core Data | Apple Developer Documentation
    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 ...Core Data Programming GuideSetting up a Core Data stackCreating a Core Data modelCore DataCore Data stack
  2. [2]
    Core Data Programming Guide: What Is Core Data? - Apple Developer
    Mar 27, 2017 · Core Data is a framework that you use to manage the model layer objects in your application. It provides generalized and automated solutions to common tasks.
  3. [3]
    [PDF] Core Data for iOS - Pearsoncmg.com
    Apple's Core Data framework presents a unified and powerful solution to storing an application's data. This book offers a comprehensive reference for the ...<|control11|><|separator|>
  4. [4]
    NSCoreDataVersionNumber | Apple Developer Documentation
    The Core Data version number released with macOS 10.4.3. var NSCoreDataVersionNumber10_5: Double. The Core Data version number released ...
  5. [5]
  6. [6]
    Creating a Core Data model | Apple Developer Documentation
    Choose File > New > File and select the iOS platform tab. Scroll down to the Core Data section, select Data Model, and click Next. Screenshot showing the Data ...
  7. [7]
    NSManagedObjectModel | Apple Developer Documentation
    A programmatic representation of the file describing your objects.
  8. [8]
    NSPersistentStoreCoordinator | Apple Developer Documentation
    Use a coordinator to add or remove persistent stores, change the type or location on-disk of those stores, query the metadata of a specific store, defer a ...
  9. [9]
  10. [10]
    NSManagedObject | Apple Developer Documentation
    NSManagedObject itself customizes many features of NSObject so that managed objects can be properly integrated into the Core Data infrastructure. Core Data ...
  11. [11]
    NSPersistentContainer | Apple Developer Documentation
    NSPersistentContainer simplifies the creation and management of the Core Data stack by handling the creation of the managed object model.
  12. [12]
    Configuring Entities | Apple Developer Documentation
    An entity describes an object, including its name, attributes, and relationships. Create an entity for each of your app's objects.
  13. [13]
  14. [14]
    Configuring Relationships | Apple Developer Documentation
    So transient relationships are useful to temporarily store calculated or derived values. Core Data does track changes to transient property values for undo ...
  15. [15]
    Core Data Programming Guide: Creating a Managed Object Model
    Mar 27, 2017 · A managed object model allows Core Data to map from records in a persistent store to managed objects that you use in your application.
  16. [16]
    Migrating your data model automatically - Apple Developer
    Core Data can typically perform an automatic data migration, referred to as lightweight migration. Lightweight migration infers the migration from the ...
  17. [17]
    Core Data Model Versioning and Data Migration - Apple Developer
    Jan 9, 2012 · Explains the managed object model versioning and data migration features of Core Data.Missing: components | Show results with:components
  18. [18]
    Modeling data | Apple Developer Documentation
    Configure the data model file to contain your app's object graph.
  19. [19]
    insertNewObject(forEntityName:into:) - Apple Developer
    Creates, configures, and returns an instance of the class for the entity with a given name. iOS 3.0+iPadOS 3.0+Mac Catalyst 13.1+macOS 10.4+tvOSvisionOS ...
  20. [20]
    init(entity:insertInto:) | Apple Developer Documentation
    Initializes a managed object from an entity description and inserts it into the specified managed object context.
  21. [21]
    NSFetchRequest | Apple Developer Documentation
    An NSPredicate predicate that specifies ... A controller that you use to manage the results of a Core Data fetch request and to display data to the user.
  22. [22]
    predicate | Apple Developer Documentation
    The predicate instance constrains the selection of objects the NSFetchRequest ... A description object used to define which properties are fetched from Core Data.
  23. [23]
    Core Data Programming Guide: Fetching Objects - Apple Developer
    Mar 27, 2017 · You will use an NSFetchRequest to access that existing data. The fetching of objects from Core Data is one of the most powerful features of this framework.
  24. [24]
    Core Data Programming Guide: Change Management
    Mar 27, 2017 · If a user deletes an object in the first context ( moc1 ), you may need to inform the second context ( moc2 ) that an object has been deleted.
  25. [25]
    delete(_:) | Apple Developer Documentation
    Specifies an object that should be removed from its persistent store when changes are committed.
  26. [26]
    NSBatchDeleteRequest | Apple Developer Documentation
    available only when using a SQLite persistent store — deletes managed objects at the SQL level of the persistent store.
  27. [27]
    save() | Apple Developer Documentation
    If a context's parent store is another managed object context, then save() only updates managed objects in that parent store. To commit changes to the external ...<|separator|>
  28. [28]
    Core Data Programming Guide: Frequently Asked Questions
    Mar 27, 2017 · If you want removed objects to be deleted from the object graph, enable the Deletes Objects On Remove option for the contentSet binding in ...Missing: delete | Show results with:delete
  29. [29]
    undoManager | Apple Developer Documentation
    Enable undo support for a context by setting this property to an instance of UndoManager. This can be an undo manager that's exclusive to the context.
  30. [30]
    undo() | Apple Developer Documentation
    undo() Sends an undo message to the context's undo manager, asking it to reverse the latest uncommitted changes applied to objects in the object graph.
  31. [31]
    Using Core Data with Cocoa Bindings - Apple Developer
    Mar 27, 2017 · If you specify an abstract parent entity, the Core Data backed controller fetches matching instances of concrete subentities. Filter ...Missing: entities | Show results with:entities
  32. [32]
    FetchRequest | Apple Developer Documentation
    Use a FetchRequest property wrapper to declare a FetchedResults property that provides a collection of Core Data managed objects to a SwiftUI view.<|separator|>
  33. [33]
    Using Core Data in the background | Apple Developer Documentation
    Core Data works in a multithreaded environment. However, not every object under the Core Data framework is thread safe.
  34. [34]
    Bring Core Data concurrency to Swift and SwiftUI - WWDC21 - Videos
    Jun 10, 2021 · Discover how Core Data is adopting the new concurrency capabilities of Swift 5.5, leading to more concise, efficient, and safe asynchronous code.
  35. [35]
    Core Data Programming Guide: Persistent Store Types and Behaviors
    Mar 27, 2017 · Core Data provides an in-memory persistent store and three disk-based persistent stores, as described in Table 16-1.
  36. [36]
    NSPersistentCloudKitContainer | Apple Developer Documentation
    Overview · NSPersistentCloudKitContainer is a subclass of NSPersistentContainer capable of managing both CloudKit-backed and noncloud stores.
  37. [37]
    Setting Up Core Data with CloudKit | Apple Developer Documentation
    Core Data with CloudKit uses the CloudKit service to access your team's containers. To enable CloudKit, configure the iCloud capability. In Project Settings, ...Missing: purpose | Show results with:purpose
  38. [38]
    TN3163: Understanding the synchronization of ... - Apple Developer
    Feb 20, 2024 · NSPersistentCloudKitContainer is designed to provide end-to-end synchronization for apps. In many cases, apps use this API to set up a Core Data stack.Capture And Analyze A... · Understand The Export · Understand The Import
  39. [39]
    Sharing Core Data objects between iCloud users - Apple Developer
    Use Core Data and CloudKit to synchronize data between devices of an iCloud user and share data between different iCloud users.
  40. [40]
  41. [41]
    [PDF] Oral History of Avadis Tevanian
    ... Enterprise Objects. Framework. So WebObjects didn't require Enterprise Objects Framework-- EOF, is what we called it-- but it benefited from it, if you had a ...
  42. [42]
    [PDF] Enterprise Objects Framework Developer's Guide
    Apple, NeXT, and the publishers have tried to make the information contained in this manual as accurate and reliable as possible, but assume no ...Missing: origins | Show results with:origins
  43. [43]
    [PDF] Apple Computer, Inc. Agrees to Acquire NeXT Software Inc.
    CUPERTINO, Calif.--Dec. 20, 1996--Apple Computer, Inc. today announced its intention to purchase. NeXT Software Inc., in a friendly acquisition for $400 ...
  44. [44]
    Welcome to Core Data | SpringerLink
    Aug 24, 2022 · In 2000, Apple as the NeXT owner dropped support for EOF and discontinued the project. When Apple launched “Cocoa,” their OOP interface, they ...Missing: origins | Show results with:origins
  45. [45]
    [PDF] Core Data Programming Guide - Iowa State University
    Nov 17, 2009 · This document is intended to assist application developers to develop applications only for Apple-labeled computers. Every effort has been made ...
  46. [46]
    OS X Frameworks - Apple Developer
    Sep 16, 2015 · See CoreAudioKit Framework Reference. CoreData.framework. 10.4. NS. Contains interfaces for managing your app's data model. See Core Data ...Missing: Tiger | Show results with:Tiger<|separator|>
  47. [47]
    NSFetchedResultsController | Apple Developer Documentation
    A controller that you use to manage the results of a Core Data fetch request and to display data to the user. iOS 3.0+iPadOS 3.0+Mac Catalyst 13.1+macOS ...Missing: OS | Show results with:OS<|separator|>
  48. [48]
    registerStoreClass:forStoreType: | Apple Developer Documentation
    Registers a persistent store subclass using the specified store type identifier. iOS 3.0+iPadOS 3.0+Mac Catalyst 13.1+macOS 10.5+tvOSvisionOS 1.0+watchOS 2.0+.Missing: OS X
  49. [49]
    NSPersistentHistoryChange - Documentation - Apple Developer
    NSPersistentHistoryChange. A change representing the insertion, update, or deletion of a managed object in the persistent store. iOS 11.0+ ...
  50. [50]
    Meet SwiftData - WWDC23 - Videos - Apple Developer
    Jun 6, 2023 · SwiftData is a powerful and expressive persistence framework built for Swift. We'll show you how you can model your data directly from Swift code.
  51. [51]
    SwiftData | Apple Developer Documentation
    Combining Core Data's proven persistence technology and Swift's modern concurrency features, SwiftData enables you to add persistence to your app quickly, with ...
  52. [52]
    Xcode 16 Release Notes | Apple Developer Documentation
    Xcode 16 includes SDKs for iOS 18, iPadOS 18, tvOS 18, watchOS 11, macOS Sequoia 15, and visionOS 2. The Xcode 16 release supports on-device debugging.
  53. [53]
    Tuning your code's performance for Apple silicon
    Tuning the performance of any code requires separate passes on both Apple silicon and Intel-based Mac computers.