Skip to content

A simple but complete Core Data app that displays repos of GitHub users

Notifications You must be signed in to change notification settings

luojun/CoreDataSkeleton

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Core Data Skeleton

A simple but complete Core Data app that displays repos of GitHub users

Goal

The aim here is a simple but relatively real and complete sample Core Data app. To be relatively complete, it needs to touch upon how Core Data

  1. Interacts with networking,
  2. Could be used as structured cache for a REST API,
  3. Deals concurrency,
  4. Works with NSFetchedResultsController in a UITableView (or UICollectionView) context, and
  5. Handles multiple entities with relationships among them.

A combination of these probably covers most requirements from most simple apps. (What is not demonstrated here is how Core Data supports manipulation of complext object graph, which is presumably the real deal about Core Data.) To make this sample app real enough, the GitHub API is used to pull some basic information about repos of GitHub users that one can interactively input into the app. To keep the app simple, other than iOS SDK, no other library was used.

Inspiration

There is a lot of good resources out there. The followiing -- mostly about concurrency -- specifically inspired this project:

  1. A Complete Core Data Application; GitHub repo here

    One of the best Core Data tutorials. Quite elegant.

  2. Core Data with multiple managed object contexts; GitHub repo here

  3. NSManagedObjectContext’s parentContext

    Parent context clearly explained.

  4. Apple's documentation

    Not the easiest to read. But worth going back again and again.

  5. WWWDC 2014 What's New in Core Data

    Fair amount of helpful information.

The followng posts were also helpful:

Caveat

While the project follows the three-tier stack (attributed to Marcus Zarra) in dealing with context and concurrency, we should keep in mind these compelling findings:

iOS 8

The project was done with Xcode 6 and targets iOS 8. While the debugging flag com.apple.CoreData.ConcurrencyDebug -- see WWWDC 2014 What's New in Core Data -- did seem to be useful, the bug reported here:

seems real and seems to remain there in iOS 8 beta 3.

The new iOS 8 NSAsynchronousFetchRequst was also tried, but it simply couldn't be made to work in the current iOS 8 beta. It would be something good to include in a future update to this project.

Known Issues

  • The app does not play well with GitHub API's rate limiting.
  • Much to be refactored (always the case) Specifically, UserViewController & RepoViewController could be made better.

About

A simple but complete Core Data app that displays repos of GitHub users

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published