Latest 1.0.0
Homepage https://github.com/paleksandrs/APCoreDataKit
License MIT
Platforms ios 9.0

license MIT

A lightweight helper library that reduces the boilerplate involved with Core Data setup and work.

Requirements

  • Xcode 8
  • Swift 3.0
  • iOS 9.0+

Installation

CocoaPods. Please use the latest CocoaPods as this framework is using Swift 3
use_frameworks!

pod 'APCoreDataKit'

Usage

Setting up NSManagedObjectContext with SQL store type
let persistentStoreType = PersistentStoreType.SQLite("SQLFileName")
let model = ManagedObjectModel(name: "XcdatamodeldName")   
let moc = NSManagedObjectContext(model: model, storeType: persistentStoreType)
Setting up NSManagedObjectContext with in memory store type
let persistentStoreType = PersistentStoreType.InMemory
let model = ManagedObjectModel(name: "XcdatamodeldName")   
let moc = NSManagedObjectContext(model: model, storeType: persistentStoreType)
Creating and inserting NSManagedObject
let entity = moc.createAndInsert(entity: Entity.self)
Deleting NSManagedObject
let objects: [Entity] = ...
moc.delete(objects: objects)
Deleting all entities using batch request
moc.delete(entity: Entity.self)
Creating a fetch request for entity
let fetchRequest = Entity.entityFetchRequest()
Executing a fetch request
let personArray: [Entity] = try moc.performFetch(request: fetchRequest)
Saving context
moc.saveContext(andWait: true, success: { 

}) { (error) in

}

License

APCoreDataKit is released under an MIT License. See LICENSE for details.

Latest podspec

{
    "name": "APCoreDataKit",
    "version": "1.0.0",
    "summary": "A lightweight library that reduces the boilerplate involved with Core Data setup and work.",
    "description": "A lightweight helper library that reduces the boilerplate involved with Core Data setup and work.",
    "homepage": "https://github.com/paleksandrs/APCoreDataKit",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": "Aleksandrs Proskurins",
    "platforms": {
        "ios": "9.0"
    },
    "source": {
        "git": "https://github.com/paleksandrs/APCoreDataKit.git",
        "tag": "1.0.0"
    },
    "source_files": "APCoreDataKit/*.swift"
}

Pin It on Pinterest

Share This