A lightweight helper library that reduces the boilerplate involved with Core Data setup and work.
- Xcode 8
- Swift 3.0
- iOS 9.0+
CocoaPods. Please use the latest CocoaPods as this framework is using Swift 3
use_frameworks!
pod 'APCoreDataKit'
let persistentStoreType = PersistentStoreType.SQLite("SQLFileName")
let model = ManagedObjectModel(name: "XcdatamodeldName")
let moc = NSManagedObjectContext(model: model, storeType: persistentStoreType)
let persistentStoreType = PersistentStoreType.InMemory
let model = ManagedObjectModel(name: "XcdatamodeldName")
let moc = NSManagedObjectContext(model: model, storeType: persistentStoreType)
let entity = moc.createAndInsert(entity: Entity.self)
let objects: [Entity] = ...
moc.delete(objects: objects)
moc.delete(entity: Entity.self)
let fetchRequest = Entity.entityFetchRequest()
let personArray: [Entity] = try moc.performFetch(request: fetchRequest)
moc.saveContext(andWait: true, success: {
}) { (error) in
}
APCoreDataKit
is released under an MIT License. See LICENSE
for details.