• Stars
    star
    192
  • Rank 202,019 (Top 4 %)
  • Language
    Objective-C
  • Created almost 12 years ago
  • Updated almost 12 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Create a Cloud Syncing Mobile App in 3 Minutes

AFNetworking + AFIncrementalStore + SDScaffoldKit = SDScaffoldSync

SDScaffoldSync

=======

This Project Would Not Be Possible Without Mattt Thompson.

SDScaffoldSync is a combination of SDScaffoldKit, AFNetworking, and AFIncrementalStore using the Heroku-Core-Data-Buildback. SDScaffoldSync was inspired by Build an iOS App in 10 Minutes with AFIncrementalStore and the Core Data Buildpack Without these contributions from Mattt, none of this would be possible. I highly encourage everyone to follow & thank Mattt Thompson for his series of open source libraries covering the mission-critical aspects of an iOS app's infrastructure. Be sure to check out its sister projects: GroundControl, SkyLab, CargoBay, and houston.

##Create a Cloud Syncing Mobile App in 3 Minutes

Building an app that syncs its data in the cloud can be difficult. That's where SDScaffoldSync comes into play. SDScaffoldSync creates a REST endpoint (via Heroku-Core-Data-Buildpack) and syncing code (via AFIncrementalStore) for you. SDScaffoldSync also leverages SDScaffoldKit to give you ready-made views for your model objects. Just create your Core Data model, hand SDScaffoldKit your Entity's name, a field to sort by, and BAM! You you have a cloud syncing app.

SDScaffoldSync is meant to save you time so you can focus on what matters, application logic. The library is still a little green behind the ears and I would love to see any issues or pull request you may have. There is a sample project and screencast if you have any question on how it all works.

Overall, this is a great way to get your project up and running then you can go from there.

Watch Screencast Video: https://vimeo.com/59389685

SDScaffoldSync

Getting Started

These are the exact steps needed to take to create an syncing client-server app in 3 minutes. You will need to have CocoaPods Installed on your machine. Watch this video for a complete demo -

  1. Install CocoaPods
  2. Create New Project with AFNetworking Xcode Template
  3. Close current project. cd to PROJECTNAME directory then
  4. Run pod install
  5. Run open PROJECTNAME.xcworkspace
  6. Create ENTITYNAME in PROJECTNAME.xcdatamodeld file
  7. Run git commit -a -m "first commit"
  8. Run heroku create --buildpack git://github.com/mattt/heroku-buildpack-core-data.git
  9. Run git push heroku master
  10. Copy random-name-here.herokuapp.com url from terminal, set kAPIBaseURLString in PROJECTNAMEAPIClient.m to random-name-here.herokuapp.com url.
  11. Add SDScaffoldKit to project. Then add #import "SDScaffoldKit.h" to PROJECTNAME-Prefix.pch
  12. Create SDScaffoldIndexViewController instance and set it to the rootViewController of the main navigationController.
  13. App Delegate should look like this:
- (BOOL)application:(UIApplication *)applicationdidFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    NSURLCache *URLCache = [[NSURLCache alloc] initWithMemoryCapacity:8 * 1024 * 1024 diskCapacity:20 * 1024 * 1024 diskPath:nil];
    [NSURLCache setSharedURLCache:URLCache];
    
    [[AFNetworkActivityIndicatorManager sharedManager] setEnabled:YES];
    
    SDScaffoldIndexViewController *scaffoldViewController = [[SDScaffoldIndexViewController alloc] 
    initWithEntityName:@"ENTITYNAME" sortBy:@"PROPERTY" context:self.managedObjectContext];
    
    self.navigationController = [[UINavigationController alloc] initWithRootViewController:scaffoldViewController];
    
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    self.window.rootViewController = self.navigationController;
    [self.window makeKeyAndVisible];
    
    return YES;
}
  1. Open http://random-name-here.herokuapp.com/MODELNAMEs in your browser i.e. http://sleepy-eyrie-2619.herokuapp.com/runs
  2. Build and Run Xcode App
  3. Follow @stevederico on twitter, tell me what you think.
  4. Watch refactor.tv, a podcast with Sam Soffes, where we cover iOS and Open-source projects each week.

Twitter image

Common Errors

  • Don't forget to change the build target from Pods. Click Pods next to the Stop button and change to PROJECTNAME, then Run. Bad Good

Legend

  • PROJECTNAME - Full name of the Project i.e. "RunLog"
  • ENTITYNAME - Core Data Model Entity Name i.e. "Run"
  • PROPERTY - An attribute of the new Entity i.e "summary"
  • random-name-here.herokuapp.com url - Heroku webserver url i.e. http://sleepy-eyrie-2619.herokuapp.com

Thanks

  • Thanks to @mattt for all his wonderful work.