Latest 1.4.0
License MIT
Platforms ios 8.0, tvos 10.0

CI Status


To run the example project, clone the repo, and run pod install from the Example directory first.


Xcode 9.4.1
Swift 4.1

New In 1.4.0

“` store.commit()

## New In 1.3.2

Fix store coordinator with iOS9 and lower

## New In 1.3.1

Reverted the throws block but a default sql file path url is being provided, if you won't provide any

## New In 1.3.0

If you won't enter a sql file, it will be provided for you. 
This is the actual implementation:

```guard let path = NSSearchPathForDirectoriesInDomains(.documentDirectory,
.userDomainMask, true).first else {
    throw SqlFile.filePathNotFound
return URL(fileURLWithPath: path).appendingPathComponent("content.sqlite")

Eventually if it can’t be created, it throws an error.

New In 1.2.0

You can now observe when a value has been inserted/added, removed, moved or updated.
All you have to do is to change the line in your Store Protocol from var model: Observable<[Entry]>? { get } to var entities: ManagedObjectObservable<[Entry]>? { get } or simply access the stores entitities with the parameter entities. Of course you can still observe the complete entities with
onValueChanged { allEntities in ... }

Here is an example.

    override func viewDidLoad() {

        store.entries?.onItemAdded { entity, indexPath in
            //... entity has been added
        store.entries?.onItemRemoved { entity, indexPath in
            //... entity has been removed
        store.entries?.onItemUpdated { entity, indexPath in
            //... entity has been updated
        store.entries?.onItemMoved { entity, from, to in
            //... entity has been moved


EMStore is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'EMStore'

Define a store and implement it like follows. The "Model" is your xcdatamodeld file name. If this is not the same, your app will enventually crash. So be aware.

protocol EntryStore {
    var model: Observable<[Entry]>? { get }
    var new: Entry? { get }
    func add(model: Entry)
    func remove(model: Entry)

final class DefaultEntryStore: ManagedObjectStore<Entry>, EntryStore {
    init() {
        super.init(storage: SqliteStorage<Entry>("Model"),
        predicate: nil,
        sortDescriptors: [NSSortDescriptor(key: "date", ascending: true)])

Now setup the store just like follows

let store: EntryStore = DefaultEntryStore()

To access the content of a store is farely easy

let fetched content = store.entries?.value

To add a new content to a store is again very easy

guard let entry = else {
} = NSDate()
store.add(model: entry)

And last but not least, we want to be notified, whenever something has been been added or removed. Therefore we use the observeable value property. Use the closure and get notified whenever something may have changed. We may provide more closures in the future to get notified if one entry has been added.

override func viewDidLoad() {

    store.entries?.onValueChanged { _ in
        //... update the table- or collectionview .. or what ever you want to do with the content

Looking forward for some feedback :)


Martin Eberl, [email protected]


EMStore is available under the MIT license. See the LICENSE file for more info.

Latest podspec

    "name": "EMStore",
    "version": "1.4.0",
    "swift_version": "4.1",
    "summary": "A simple SQLite wrapper library for faster setup of core data",
    "description": "With thos library, you don't need to write all this ManagedObjectContext and Persistance Store Coordinator, because it does that for you. All you need to do is, to focus on your models",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "[email protected]": "Martin Eberl"
    "source": {
        "git": "",
        "tag": "1.4.0"
    "platforms": {
        "ios": "8.0",
        "tvos": "10.0"
    "source_files": "EMStore/Classes/**/*"

Pin It on Pinterest

Share This