Latest 0.1.0
License MIT
Platforms ios 9.0, requires ARC

LiteData Logo



LiteData provides a very simple core data stack, and a few protocols to make it nice to work with NSManagedObjects and the like. It is heavily influenced by the talk Modern Core Data by Daniel Eggert.

Because it’s so lightweight there are couple caveats:

  • NSManagedObject class names must match the entity name.
  • Though it makes the simple things very easy, the more complicated things must be done almost completely manually.

That being said, I’m definitely willing to add more features. This is my first foray into CoreData, so as I use it more, this library will evolve and improve.


Jazzy docs available here.

Getting Started

LiteData provides an easy to use core data stack with sensible defaults. Creating a stack is as simple as telling it the model name:

var stack: LiteStack!

do {
    try stack = LiteStack(modelName: "Model")
} catch {
    fatalError("Error setting up stack: (error)")

Conforming to ManagedObjectType gives your NSManagedObjects the power of LiteData. Return some default descriptors, and you get effortless fetch requests and fetched results controllers:

extension Post: ManagedObjectType {
    static var defaultSortDescriptors: [NSSortDescriptor] {
        return [NSSortDescriptor(key: "date", ascending: true)]

/* Later */

// Create a post
let post: Post = stack.context.insert()

// Create a fetched results controller
let frc = stack.context.sortedFetchedResults(ofType: Post.self)

// Get a simple fetch request
let request = Post.sortedFetchRequest

There’s also a KeyCodable protocol you can implement if you’d like to, which makes it much easier and safer to work with keys:

extension Post: KeyCodable {
    enum Key: String {
        case text
        case likes
        case date
        case identifier

/* Later */

extension Post: ManagedObjectType {
    static var defaultSortDescriptors: [NSSortDescriptor] {
        let dateDescriptor = NSSortDescriptor(key:, ascending: true)
        let likesDescriptor = NSSortDescriptor(key: Key.likes.rawValue, ascending: true)
        return [dateDescriptor, likesDescriptor]


  • Xcode 7.3+
  • iOS 9+


LiteData is available through CocoaPods and Carthage.



pod "LiteData"


github "kylebshr/LiteData"


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

Latest podspec

    "name": "LiteData",
    "version": "0.1.0",
    "license": "MIT",
    "description": "LiteData is a very small framework to make working with Core Data a little easier and swiftier. It doesn't do a lot, but it makes the basics very simple.",
    "summary": "A very light and swifty core data stack",
    "homepage": "",
    "social_media_url": "",
    "authors": "Kyle Bashour",
    "source": {
        "git": "",
        "tag": "0.1.0"
    "source_files": "Source/*.swift",
    "platforms": {
        "ios": "9.0"
    "requires_arc": true

Pin It on Pinterest

Share This