A powerful object graph and persistence framework that has been the standard for iOS data management since iOS 3. Core Data provides object lifecycle management, undo/redo, and efficient data storage.
of iOS users worldwide can use Core Data (iOS 3+ required)
| iOS Version | Market Share | Status |
|---|---|---|
| iOS 18.7 | 30.3% | Supported |
| iOS 18.6 | 29.8% | Supported |
| iOS 26.1 | 10.7% | Supported |
| iOS 18.5 | 6.0% | Supported |
| iOS 16.7 | 2.3% | Supported |
| iOS 26.2 | 2.0% | Supported |
| iOS 18.3 | 1.8% | Supported |
| iOS 15.8 | 1.8% | Supported |
| iOS 11.0 | 1.7% | Supported |
| iOS 17.6 | 1.7% | Supported |
Object graph management with relationships
Automatic undo and redo support
Efficient data storage with SQLite backend
Data validation and migration tools
Fault handling for memory efficiency
Mature and battle-tested framework
Create a Core Data entity using NSManagedObject
import CoreData
@objc(Person)
public class Person: NSManagedObject {
@NSManaged public var name: String
@NSManaged public var age: Int16
@NSManaged public var email: String?
}
extension Person {
@nonobjc public class func fetchRequest() -> NSFetchRequest<Person> {
return NSFetchRequest<Person>(entityName: "Person")
}
}Create and save a new managed object
import CoreData
func createPerson(context: NSManagedObjectContext) {
let person = Person(context: context)
person.name = "John Doe"
person.age = 30
person.email = "john@example.com"
do {
try context.save()
print("Person saved successfully")
} catch {
print("Error saving: \(error)")
}
}Query data with NSFetchRequest
import CoreData
func fetchPeople(context: NSManagedObjectContext) -> [Person] {
let fetchRequest: NSFetchRequest<Person> = Person.fetchRequest()
fetchRequest.predicate = NSPredicate(format: "age > %d", 25)
fetchRequest.sortDescriptors = [NSSortDescriptor(key: "name", ascending: true)]
do {
let people = try context.fetch(fetchRequest)
return people
} catch {
print("Error fetching: \(error)")
return []
}
}A powerful object graph and persistence framework that has been the standard for iOS data management since iOS 3. Core Data provides object lifecycle management, undo/redo, and efficient data storage.
Core Data is available on iOS 3 and later. Currently, 99.8% of iOS users worldwide can use this framework.
Related frameworks include Swiftdata, Cloudkit. Each has different capabilities and iOS version requirements.