/nsrails

iOS/Mac OS framework for Rails

Primary LanguageObjective-CMIT LicenseMIT

nsrails.com


Welcome!

NSRails is a light-weight, drop-in Objective-C framework (iOS or OS X) for simple but powerful communication with your Rails server.

What does NSRails do?

NSRails provides simple, high-level APIs that give your Objective-C classes ActiveResource-like support. This means CRUD and other operations on your corresponding Rails objects can be called natively via Objective-C methods.

Instances will inherit methods to remotely create, read, update, or destroy a remote object:

Article *newArticle = [[Article alloc] init];
newArticle.title = @"Title";
newArticle.content = @"Some text";
[newArticle remoteCreate:&error];     //This article and its properties created right on a Rails server

Classes will inherit methods to retrieve all objects, or only certain ones:

NSArray *allArticles = [Article remoteAll:&error];
Article *articleNumber1 = [Article remoteObjectWithID:1 error:&error];

// Display your article(s)! They're ready with their properties populated directly from your remote DB

Features:

How do I get started?

It's fairly painless. Drop the source folder into your Xcode project, and see this page.

Some more resources:

  • Easily translate Rails models into Objective-C classes using autogen tool
  • Watch the screencast
  • See the Wiki
  • Browse the included demo iPhone app - it goes straight to a live Rails app at nsrails.com, so you won't even have to launch a server to get started. The source for this site is also included. Have fun and be civil!

Credits

NSRails is published under the MIT license, meaning you can use the sources however you'd like.

Thanks a lot to the SB JSON framework for JSON parsing and writing, and to ObjectiveResource for being largely the inspiration for NSRails.