From 95c87aa689b043f04d8c1254a9db0f138f6cb151 Mon Sep 17 00:00:00 2001 From: John Estropia Date: Thu, 19 Mar 2015 23:40:42 +0900 Subject: [PATCH] Create README.md --- README.md | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..884df14 --- /dev/null +++ b/README.md @@ -0,0 +1,59 @@ +# HardcoreData +[![Version](https://img.shields.io/cocoapods/v/HardcoreData.svg?style=flat)](http://cocoadocs.org/docsets/HardcoreData) +[![Platform](https://img.shields.io/cocoapods/p/HardcoreData.svg?style=flat)](http://cocoadocs.org/docsets/HardcoreData) +[![License](https://img.shields.io/cocoapods/l/HardcoreData.svg?style=flat)](http://cocoadocs.org/docsets/HardcoreData) + +Simple, elegant, and smart Core Data programming with Swift + + +## Features +- Supports multiple persistent stores per *data stack*, just the way .xcdatamodeld files are supposed to. HardcoreData will also manage one *data stack* by default, but you can create and manage as many as you need. (see "Setting up") +- Ability to plug-in your own logging framework (or your favorite 3rd-party logger). (see "Logging and error handling") +- Makes it hard to fall into common concurrency mistakes. All Core Data tasks are encapsulated into safer, higher-level abstractions without sacrificing flexibility and customizability. (see "Saving and processing transactions") +- Provides convenient API for common use cases. (see "Fetching and querying") +- Pleasant API designed around Swift’s code elegance and type safety. (see "TL;DR sample codes") + + + +#### TL;DR sample codes +```swift +``` + + + +## Architecture +For maximum safety and performance, HardcoreData will enforce coding patterns and practices it was designed for. (Don't worry, it's not as scary as it sounds.) But it is advisable to understand the "magic" of HardcoreData before you use it in your apps. + +If you are already familiar with the inner workings of CoreData, here is a mapping of `HardcoreData` abstractions: + +| *Core Data* | *HardcoreData* | +| --- | --- | +| `NSManagedObjectModel` / `NSPersistentStoreCoordinator`
(.xcdatamodeld file) | `DataStack` | +| `NSPersistentStore`
("Configuration"s in the .xcdatamodeld file) | `DataStack` configuration
(multiple sqlite / in-memory stores per stack) | +| `NSManagedObjectContext` | `BaseDataTransaction` subclasses
(`SynchronousDataTransaction`, `AsynchronousDataTransaction`, `DetachedDataTransaction`) | + +RestKit and MagicalRecord set up their `NSManagedObjectContext` this way: + +This ensures maximum data integrity between contexts without blocking the main queue. But as Florian Kugler's investigation found out, merging contexts is still by far faster than nesting contexts. HardcoreData's `DataStack` takes the best of both worlds by treating the main `NSManagedObjectContext` as a read-only context, and only allows changes to be made within *transactions*: + +This allows for a butter-smooth main thread, while still benefitting from the safety of nested contexts. + + + +## Setting up + + +## Saving and processing transactions + + +## Fetching and querying + + +## Logging and error handling + + +## Observing changes and notifications (currently in the works) + + + +