Skip to content

A port of Ruby on Rails' ActiveResource to Objective-C (and specifically the iPhone)

License

Notifications You must be signed in to change notification settings

lgalabru/objectiveresource

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

ObjectiveResource is a port of Rails’ ActiveResource framework to Objective-C.

The primary purpose of this project is to quickly and easily connect
iPhone applications with servers running Rails.

This project relies on ObjectiveSupport, which aims to provide some popular
Rubyisms to Objective-C. If you checkout this project using git, you can
pull down ObjectiveSupport by doing a “git submodule init” followed by
a “git submodule update”.

Getting Started

Sample Code

This project comes bundled with a sample iPhone application and a sample
Rails application. To see how everything works together you can open
up the .xcodeproj and fire up a rails server in sample_rails_app.

Integrating Objective Resource with your project

Objective Resource is compiled as a static library, and the easiest way to add it to your project is to use Xcode’s “dependent project” facilities. Here is how:

1. Clone the Objective Resource git repository: `git clone git://github.com/lgalabru/objectiveresource.git`. Make sure
you store the repository in a permanent place because Xcode will need to reference the files
every time you compile your project.

2. Locate the “ObjectiveResource.xcodeproj” file under “objectiveresource/src”. Drag ObjectiveResource.xcodeproj and drop it onto
the root of your Xcode project’s “Groups and Files” sidebar. A dialog will appear — make sure
“Copy items” is unchecked and “Reference Type” is “Relative to Project” before clicking “Add”.

3. Now you need to link the ObjectiveResource static library to your project. Click the “ObjectiveResource.xcodeproj”
item that has just been added to the sidebar. Under the “Details” table, you will see a single
item: libObjectiveResource.a. Check the checkbox on the far right of libObjectiveResource.a.

4. Now you need to add ObjectiveResource as a dependency of your project, so Xcode compiles it whenever
you compile your project. Expand the “Targets” section of the sidebar and double-click your
application’s target. Under the “General” tab you will see a “Direct Dependencies” section.
Click the “+” button, select “ObjectiveResource”, and click “Add Target”.

5. Finally, we need to tell your project where to find the ObjectiveResource headers. Open your
“Project Settings” and go to the “Build” tab. Look for “Header Search Paths” and double-click
it. Add the relative path from your project’s directory to the “objectiveresource/src” directory.

6. While you are in Project Settings, go to “Other Linker Flags” under the “Linker” section, and
add “-ObjC” and “-all_load” to the list of flags.

7. You’re ready to go. Just #import “ObjectiveResource/ObjectiveResource.h” anywhere you want to use ObjectiveResource classes
in your project.

Contributing

Running Tests

Unit testing makes use of the SenTest work-alike from Google Toolbox for Mac.

To run the tests, select the “Unit Tests” target in XCode and Build and Run.

You will need to have Rails installed along with the populator and faker
gems, as the project uses a “Run Script” to setup a local Rails
server for testing.

About

A port of Ruby on Rails' ActiveResource to Objective-C (and specifically the iPhone)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 96.0%
  • Ruby 2.9%
  • Other 1.1%