Git Product home page Git Product logo

nimble's Introduction

Nimble

Core Data (and iCloud) made nimble and fast.

Why

The answer is quite easy. I needed a Core Data wrapper with these features:

  • Easy setup and finders (anyone said MagicalRecord?)
  • Simple architecture with a main and a background context. A lot has been written about how much faster are 2 context rather than parent+children. Read here and here if you're interested
  • iOS 7 and iCloud ready (but still compatible)

Install

CocoaPods makes our lifes easy :)

pod "Nimble"

and then import Nimble.h into your prefix file.

How it works

First, set up the local or cloud store based on what you need

[NimbleStore nb_setupStore:&error];
// OR
[NimbleStore nb_setup_iCloudStore:&error]

The iCloud set up, thanks to iOS 7's API is natively completely asynchronous and a local store is created ready to use waiting for the iCloud's one.
At this moment, iCloud is available for iOS 7 only as it is not good enough in iOS 6.

Savers

Easily save in main or background thread, everything is then merged into the main context

[NimbleStore nb_saveInBackground:^(NBContextType contextType) {
  Book *book = [Book nb_createInContextOfType:contextType];
  book.name = @"Best book ever";
}];

Creators

You can create a new object with

[YourModelObject nb_createInContextOfType:NBMainContext];

to create an object and in the same time initialize some of its property, you can just use

[YourModelObject nb_createInContextOfType:NBMainContext initializingPropertiesWithDictionary:@{
    @"name" : @"Marco" ,
    @"surname" : @"Sero"
}];

Finders and fetchers

You can find all type of finders and fetchers in NSManagedObject+Finders.h

For example, to fetch and change an object in background you can just do:

[NimbleStore nb_saveInBackground:^(NBContextType contextType) {
  Book *book = [Book nb_findFirstInContext:contextType];
  book.name = @"updated name";
}];

TODOs

It just needs some love from you guys as it has never been tested on a real app. After that, here's my list:

  • more tests & documentation
  • iCloud sync issues handler
  • compile time switch to use everything without the nb_ prefix
  • data importers

Contact

Marco Sero

License

Nimble is available under the MIT license. See the file LICENSE.

nimble's People

Contributors

marcosero avatar shsteven avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.