<commit_before># APCoreDataKit
 [![license MIT](https://img.shields.io/cocoapods/l/JSQCoreDataKit.svg)][mitLink]


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](http://cocoapods.org). Please use the latest CocoaPods as this framework is using Swift 3  

````ruby
use_frameworks!

pod 'APCoreDataKit'

````

## Usage 

##### Setting up `NSManagedObjectContext` with SQL store type

````swift
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

````swift
let persistentStoreType = PersistentStoreType.InMemory
let model = ManagedObjectModel(name: "XcdatamodeldName")   
let moc = NSManagedObjectContext(model: model, storeType: persistentStoreType)
````

##### Creating and inserting `NSManagedObject`

````swift
let entity = moc.createAndInsert(entity: Entity.self)
````

##### Deleting `NSManagedObject`

````swift
moc.delete(objects: [EntityInstance1,EntityInstance2, ...])
````

##### Deleting all entities using batch request 

````swift<commit_msg>Read me file updated<commit_after># APCoreDataKit
 [![license MIT](https://img.shields.io/cocoapods/l/JSQCoreDataKit.svg)][mitLink]


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](http://cocoapods.org). Please use the latest CocoaPods as this framework is using Swift 3  

````ruby
use_frameworks!

pod 'APCoreDataKit'

````

## Usage 

##### Setting up `NSManagedObjectContext` with SQL store type

````swift
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

````swift
let persistentStoreType = PersistentStoreType.InMemory
let model = ManagedObjectModel(name: "XcdatamodeldName")   
let moc = NSManagedObjectContext(model: model, storeType: persistentStoreType)
````

##### Creating and inserting `NSManagedObject`

````swift
let entity = moc.createAndInsert(entity: Entity.self)
````

##### Deleting `NSManagedObject`

````swift
let objects: [Entity] = ...
moc.delete(objects: objects)
````

##### Deleting all entities using batch request 

````swift
{'fraction_non_alphanumeric': 0.1346444780635401, 'fraction_numerical': 0.00529500756429652, 'mean_word_length': 5.9605263157894735, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5336413', 'n_tokens_mistral': 886, 'n_tokens_neox': 797, 'n_words': 223}