Community-maintained Agent Skills for complete Swift and Apple-platform app delivery.
72
90%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Medium
Suggest reviewing before use
Build and maintain data persistence using Core Data for apps that have not adopted SwiftData. Covers stack setup, concurrency, batch operations, NSFetchedResultsController, persistent history tracking, staged migration, and testing.
Core Data contexts are bound to queues: viewContext runs on the main queue, while background tasks use newBackgroundContext().
context.perform(_:) or context.performAndWait(_:).NSManagedObject instances between contexts or threads; pass NSManagedObjectID and re-fetch via existingObject(with:).automaticallyMergesChangesFromParent = true and configure mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy on viewContext.import CoreData
func updateTrip(id: NSManagedObjectID, name: String) async throws {
let context = CoreDataStack.shared.newBackgroundContext()
try await context.perform {
guard let trip = try context.existingObject(with: id) as? CDTrip else { return }
trip.name = name
if context.hasChanges { try context.save() }
}
}Drives UI collections from an NSFetchRequest with automatic change tracking:
controller(_:didChangeContentWith:)) on iOS 13+ to animate UI changes.deleteCache(withName:) before changing predicate or sort descriptors, or pass cacheName: nil.NSBatchInsertRequest, NSBatchUpdateRequest, and NSBatchDeleteRequest execute directly at the SQLite level, bypassing managed object contexts.
resultType = .objectIDs / .resultTypeObjectIDs.NSManagedObjectContext.mergeChanges(fromRemoteContextSave:into:).Deny).Track store modifications across app extensions, widgets, and processes:
NSPersistentHistoryTrackingKey: true in store options.NSPersistentHistoryChangeRequest and merge them into local contexts.NSStagedMigrationManager with lightweight and custom stages (NSCustomMigrationStage) for deterministic upgrades. Read references/staged-migration.md.@Attribute(originalName:). Route pure SwiftData work to the swiftdata skill.Use NSInMemoryStoreType for deterministic unit testing. Share a single compiled NSManagedObjectModel instance across tests to prevent duplicate entity runtime errors.
NSManagedObjectID and refetch with existingObject(with:).if context.hasChanges.mergePolicy causes conflict save crashes. Set NSMergeByPropertyObjectTrumpMergePolicy.@unchecked Sendable.NSPersistentContainer created once and shared across the appperform(_:) or performAndWait(_:)NSManagedObject instances cross thread or context boundariesviewContext.automaticallyMergesChangesFromParent is enabledmergePolicy configured on contexts to handle conflicts cleanlymergeChangesNSFetchedResultsController requests include explicit sort descriptorsNSManagedObjectModel.tessl-plugin
skills
accessorysetupkit
references
activitykit
adattributionkit
references
alarmkit
references
app-clips
app-intents
app-store-optimization
app-store-review
apple-on-device-ai
appmigrationkit
audioaccessorykit
references
authentication
references
avfoundation-audio
references
avkit
background-processing
references
browserenginekit
callkit
references
carplay
cloudkit
contacts-framework
references
core-bluetooth
references
core-data
core-haptics
references
core-motion
references
core-nfc
references
coreml
references
cryptokit
cryptotokenkit
debugging-instruments
device-integrity
references
energykit
references
eventkit
family-controls
references
financekit
focus-engine
gamekit
git-branching-workflow
references
healthkit
references
homekit
references
ios-accessibility
ios-app-workflow
references
ios-ettrace-performance
ios-localization
ios-memgraph-analysis
ios-networking
ios-simulator
references
metrickit
references
musickit
references
natural-language
paperkit
references
passkit
references
pdfkit
pencilkit
references
permissionkit
references
photokit
push-notifications
quicklook
references
realitykit
references
relevancekit
references
scenekit
sensorkit
shazamkit
references
speech-recognition
references
spritekit
storekit
swift-api-design-guidelines
swift-architecture
references
swift-charts
swift-codable
references
swift-code-review
swift-concurrency
swift-formatstyle
references
swift-language
swift-security
references
swift-testing
swiftdata
swiftlint
swiftui-animation
swiftui-gestures
references
swiftui-layout-components
swiftui-liquid-glass
references
swiftui-patterns
swiftui-performance
swiftui-responsive-layout
swiftui-uikit-interop
swiftui-webkit
tabletopkit
tipkit
vision-framework
weatherkit
references