<commit_before>![AlecrimCoreData](https://raw.githubusercontent.com/Alecrim/AlecrimCoreData/master/AlecrimCoreData.png)

[![Language: Swift](https://img.shields.io/badge/lang-Swift-orange.svg?style=flat)](https://developer.apple.com/swift/)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://raw.githubusercontent.com/Alecrim/AlecrimCoreData/develop/LICENSE)
[![CocoaPods](https://img.shields.io/cocoapods/v/AlecrimCoreData.svg?style=flat)](http://cocoapods.org)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![Forks](https://img.shields.io/github/forks/Alecrim/AlecrimCoreData.svg?style=flat)](https://github.com/Alecrim/AlecrimCoreData/network)
[![Stars](https://img.shields.io/github/stars/Alecrim/AlecrimCoreData.svg?style=flat)](https://github.com/Alecrim/AlecrimCoreData/stargazers)

AlecrimCoreData is a framework to easily access Core Data objects in Swift.

## Getting Started

### Data Context

To use AlecrimCoreData you will need to create a inherited class from `AlecrimCoreData.Context` and declare a property or method for each entity in your data context like the example below:

```swift
import AlecrimCoreData

let dataContext = DataContext()!

class DataContext: Context {
	var people:      Table<Person>     { return Table<Person>(context: self) }
	var departments: Table<Department> { return Table<Department>(context: self) }
}
```

It's important that properties (or methods) always return a _new_ instance of a `AlecrimCoreData.Table` class.

### Entities

It's assumed that all entity classes was already created and added to the project. In the above section example there are two entities: `Person` and `Department`.

### Optional Code Generation Tool

You can write managed object classes by hand or generate them using Xcode. Now you can also use ACDGen. ;-)

ACDGen app is a Core Data entity class generator made with AlecrimCoreData in mind. It is completely optional, but since it can also generate attribute class members for use in closure parameters, the experience using AlecrimCoreData is greatly improved.

You can use it from `Bin` folder.

## Usage
<commit_msg>Updated README file<commit_after>![AlecrimCoreData](https://raw.githubusercontent.com/Alecrim/AlecrimCoreData/master/AlecrimCoreData.png)

[![Language: Swift](https://img.shields.io/badge/lang-Swift-orange.svg?style=flat)](https://developer.apple.com/swift/)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://raw.githubusercontent.com/Alecrim/AlecrimCoreData/develop/LICENSE)
[![CocoaPods](https://img.shields.io/cocoapods/v/AlecrimCoreData.svg?style=flat)](http://cocoapods.org)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![Forks](https://img.shields.io/github/forks/Alecrim/AlecrimCoreData.svg?style=flat)](https://github.com/Alecrim/AlecrimCoreData/network)
[![Stars](https://img.shields.io/github/stars/Alecrim/AlecrimCoreData.svg?style=flat)](https://github.com/Alecrim/AlecrimCoreData/stargazers)

AlecrimCoreData is a framework to easily access Core Data objects in Swift.

## Getting Started

### Data Context

To use AlecrimCoreData you will need to create a inherited class from `AlecrimCoreData.Context` and declare a property or method for each entity in your data context like the example below:

```swift
import AlecrimCoreData

let dataContext = DataContext()!

class DataContext: Context {
	var people:      Table<Person>     { return Table<Person>(context: self) }
	var departments: Table<Department> { return Table<Department>(context: self) }
}
```

It's important that properties (or methods) always return a _new_ instance of a `AlecrimCoreData.Table` class.

### Entities

It's assumed that all entity classes was already created and added to the project. In the above section example there are two entities: `Person` and `Department`.

### ACDGen

You can write managed object classes by hand or generate them using Xcode. Now you can also use ACDGen. ;-)

ACDGen app is a Core Data entity class generator made with AlecrimCoreData in mind. It is completely optional, but since it can also generate attribute class members for use in closure parameters, the experience using AlecrimCoreData is greatly improved.

You can open it from the `Bin` folder.

## Usage

{'fraction_non_alphanumeric': 0.11836183618361837, 'fraction_numerical': 0.0013501350135013501, 'mean_word_length': 5.565731166912851, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 24, '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': '845682', 'n_tokens_mistral': 1416, 'n_tokens_neox': 1357, 'n_words': 378}