All Projects → mac-cain13 → Coredatakit

mac-cain13 / Coredatakit

Licence: mit
CoreDataKit makes common operations on objects and importing into CoreData a breeze.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Coredatakit

Skopelos
A minimalistic, thread safe, non-boilerplate and super easy to use version of Active Record on Core Data. Simply all you need for doing Core Data. Swift flavour.
Stars: ✭ 231 (+560%)
Mutual labels:  coredata, persistence
Storagekit
Your Data Storage Troubleshooter 🛠
Stars: ✭ 225 (+542.86%)
Mutual labels:  coredata, persistence
Justpersist
JustPersist is the easiest and safest way to do persistence on iOS with Core Data support out of the box. It also allows you to migrate to any other persistence framework with minimal effort.
Stars: ✭ 157 (+348.57%)
Mutual labels:  coredata, persistence
iOS-Developer-Nanodegree
Learn how to program apps for the iPhone and iPad
Stars: ✭ 20 (-42.86%)
Mutual labels:  persistence, coredata
Docker Postgres
A docker container running PostgreSQL
Stars: ✭ 22 (-37.14%)
Mutual labels:  persistence
Jsqcoredatakit
A swifter Core Data stack
Stars: ✭ 549 (+1468.57%)
Mutual labels:  coredata
Groot
From JSON to Core Data and back.
Stars: ✭ 533 (+1422.86%)
Mutual labels:  coredata
Saint
👁 (s)AINT is a Spyware Generator for Windows systems written in Java. [Discontinued]
Stars: ✭ 522 (+1391.43%)
Mutual labels:  persistence
Pulsarcast
A pub-sub system for the distributed web - my master thesis @ IST
Stars: ✭ 33 (-5.71%)
Mutual labels:  persistence
Use Persisted State
A custom React Hook that provides a multi-instance, multi-tab/browser shared and persistent state.
Stars: ✭ 943 (+2594.29%)
Mutual labels:  persistence
Cdttest
Core Data test
Stars: ✭ 5 (-85.71%)
Mutual labels:  coredata
Fasteasymapping
A tool for fast serializing & deserializing of JSON
Stars: ✭ 556 (+1488.57%)
Mutual labels:  coredata
Appserver
A multithreaded application server for PHP, written in PHP.
Stars: ✭ 930 (+2557.14%)
Mutual labels:  persistence
Entityauditbundle
Audit for Doctrine Entities
Stars: ✭ 546 (+1460%)
Mutual labels:  persistence
Avsqldebugger
A Simple Core Data Debugger that will look inside your apps DB
Stars: ✭ 30 (-14.29%)
Mutual labels:  coredata
Mobx Persist
persist mobx stores
Stars: ✭ 525 (+1400%)
Mutual labels:  persistence
Alecrimcoredata
Core Data made simple.
Stars: ✭ 779 (+2125.71%)
Mutual labels:  coredata
Graph
Graph is a semantic database that is used to create data-driven applications.
Stars: ✭ 855 (+2342.86%)
Mutual labels:  coredata
Nano Sql
Universal database layer for the client, server & mobile devices. It's like Lego for databases.
Stars: ✭ 717 (+1948.57%)
Mutual labels:  persistence
Hibernate Springboot
Collection of best practices for Java persistence performance in Spring Boot applications
Stars: ✭ 589 (+1582.86%)
Mutual labels:  persistence

2016-04-09: End of life

CoreDataKit is no longer being updated with new features. It is used in several projects, and probably will be updated with new Swift versions. But it is no longer actively developed.

CoreDataKit

CoreDataKit takes care of the hard and verbose parts of CoreData. It manages child contexts for you and helps to easily fetch, create and delete objects.

CoreData: object graph management solution, including persistence. Kit: set of equipment needed for a specific purpose.

Installation

CocoaPods is the advised way to include CoreDataKit into your project. A basic Podfile including CoreDataKit would look like this:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'CoreDataKit'

Version guide

  • Swift 4: Use 0.13 and up
  • Swift 3: Use 0.12
  • Swift 2.3: Use 0.11
  • Swift 2.2: Use 0.10

Usage

The most basic and most used variant to setup a stack backed by an automigrating SQLite store is this:

// Initialize CoreData stack
if let persistentStoreCoordinator = NSPersistentStoreCoordinator(automigrating: true) {
  CDK.sharedStack = CoreDataStack(persistentStoreCoordinator: persistentStoreCoordinator)
}

Implement NamedManagedObject protocol

For CoreDataKit to be able to use your NSManagedObject subclass, such as Car in the example below, CDK needs to have the subclass implement the NamedManagedObject protocol in order to be able to initialize your class:

class Car: NSManagedObject, NamedManagedObject {

  static var entityName = "Car" // corresponding to your Entity name in your xcdatamodeld
  
  @NSManaged var color: String
  @NSManaged var model: String
}

From here you are able to use the shared stack. For example to create and save an entity, this example performs a block an a background context, saves it to the persistent store and executes a completion handler:

CDK.performOnBackgroundContext(block: { context in
  do {
    let car = try context.create(Car.self)
    car.color = "Hammerhead Silver"
    car.model = "Aston Martin DB9"

    return .saveToPersistentStore
  }
  catch {
    return .doNothing
  }
}, completionHandler: { result in
  do {
    try result()
    print("Car saved, time to update the interface!")
  }
  catch {
    print("Saving Harvey Specters car failed with error: \(error)")
  }
})

Using promises

If you prefer using promises, instead of the callback style of this library, you can use the Promissum library with CoreDataKit. Using the CoreDataKit+Promise extension, the example from above can be rewritten as such:

let createPromise = CDK.performOnBackgroundContextPromise { context in
  do {
    let car = try context.create(Car.self)
    car.color = "Hammerhead Silver"
    car.model = "Aston Martin DB9"

    return .saveToPersistentStore
  }
  catch {
    return .doNothing
  }
}

createPromise
  .then { _ in
    print("Car saved, time to update the interface!")
  }
  .trap { error in
    print("Saving Harvey Specters car failed with error: \(error)")
  }

Contributing

We'll love contributions, please report bugs in the issue tracker, create pull request (please branch of develop) and suggest new great features (also in the issue tracker).

License & Credits

CoreDataKit is written by Mathijs Kadijk and available under the MIT license, so feel free to use it in commercial and non-commercial projects. CoreDataKit is inspired on MagicalRecord.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].