Core Data And Swift

Been quite a while since the last time we rounded up Core Data goodies, since when we’ve gone through The iCloud Angst Apocalypse and ended up with that class of problem being relegated to the new CloudKit hotness … if you don’t need, like, cross-platform access or anything. Which most people want. As, indeed, we’re going to be designing the iOS side of a project in that cross-platform space next week; so let’s take a look at what’s going on now in the new Swifty iOS 8 world, shall we?

First off, here’s an decently comprehensive curation of important tools as the Swift world dawns — keep an eye on all of these to see how they adapt to new world Swiftiness:

Top 10 Core Data Tools and Libraries :

Marcus Zarra gives us The Core Data Stack In Swift

Like videos? There’s a bunch here.


AERecord: ”Why do we need yet another one Core Data wrapper? You tell me!”

(h/t ManiacDev) AlecrimCoreData: “a Core Data wrapper library written in Swift, “inspired” by MagicalRecord and LINQ.”

JSQCoreDataKit: “A swifter Core Data stack.” — rewrite of RSTCoreDataKit

QueryKit is a nifty Core Data query language in Swift; also check out KFData for some convenient Objective-C conveniences

SugarRecord: “…you’ll be able to start the CoreData stack structure just with a line of code and start working with your database models using closures thanks to the fact that SugarRecord is completly written in Swift.”

SuperRecord: “A small set of utilities to make working with CoreData and Swift a bit easier.”

CoreDataSwagger: “Extensions for CoreData on iOS.”

CoreDataKit: “makes common operations on objects and importing into CoreData a breeze.”

New in Core Data and iOS 8: Batch Updating with Core Data Demo: Batch Updating and Asynchronous Fetching

Swift: Distributing Core Data Entities Over a Network

iOS 8: Core Data and Asynchronous Fetching

Your First Core Data App Using Swift

Protocols in Swift with Core Data

Core Data versioning is not temporal … My general recommendation is to avoid heavy migrations at all costs. They are not designed to work on iOS and frequently cause issues.”

Core Data Relationships Data Loss Bug when calling migratePersistentStore

WatchKit [and all others] Extension Problem: Sharing a Core Data Store Can Lead to Duplicate Entries

Multiple NSManagedObjectContexts – preventing race conditions and deadlocks

Core Data Migrations Swift Tutorial

Core Data in Swift Tutorial (Part 1)

Swift, Core Data, and unit testing

Unit Testing Model Layer with Core Data and Swift

FBFetchedResultsController: “A drop-in replacement for NSFetchedResultsController built to work around the fact that NSFetchedResultsController does not work with parent/child contexts.”

Better Core Data models in Swift

Core Data Cheat Sheet for Swift iOS Developers

Sync: “Modern JSON synchronization to Core Data.”

JsonManagedObject-Swift: “Swift framework to convert JSON in NSManagedObject and vice versa.”

Core Data vs. ARC

Using Core Data with Swift “With Swift there’s a decent chance that using Xcode’s subclasses will actually crash your app … If you’re using mogenerator, you’re covered for Core Data optionals.”

Using Swift to Seed a Core Data Database

Marcus Zarra: My Core Data Stack

The Generation Gap design pattern and CoreData reminds us of mogenerator 1.28 now with “experimental” Swift code generation

Using Core Data in Swift

Core Data Basics: Preload Data and Use Existing SQLite Database

SwiftRecord: Swift Library Providing An Active Record Implemention For Managing Core Data Objects

PhiLipsStack: “aims to create a CoreData stack from model to context”

CoreStore: “Simple, elegant, and smart Core Data programming with Swift”

Shared Core Data “discusses strategies for dealing with Core Data updates across the members of an App Group.”

Core Data and Aggregate Fetches in Swift

Moving from Objective-C to Swift with Core Data

Introducing the Big Nerd Ranch Core Data Stack

Expressive Domain Model, Core Data, and You

Core Data and Aggregate Fetches in Swift

Core Data and Swift: Subclassing NSManagedObject

Why Swift Is the Most Satisfying Language for Using Core Data

Core Data Threading Demystified

Pragmatic Core Data

CoreValue: “Lightweight Framework for using Core Data with Value Types”

Core Data Type Safety With Swift

Modern Core Data

Alex | August 16, 2014
  • tadija November 7, 2014 at 6:18 am
    I made this new Core Data wrapper for iOS in Swift - You can use it to setup Core Data stack like this: AERecord.setupCoreDataStack() Access context for current thread like this: AERecord.defaultContext Save context like this: AERecord.saveContext() Create fetch requests like this: NSManagedObject.create() NSManagedObject.firstOrCreateWithAttribute("city", value: "Belgrade") NSManagedObject.deleteAll() let predicate = ... NSManagedObject.firstWithPredicate(predicate) NSManagedObject.allWithAttribute("year", value: 1984) And much more... I hope it will be useful for someone.

Leave a Reply