Moving an Xcode Project to MacRuby from Objective-C
Moving an Xcode project from Objective-C to MacRuby can be useful as a way to create a MacRuby example. The Xcode distribution, in particular, contains dozens of example projects which could serve as starting points. One might also wish to convert a real-world application in order to benefit from MacRuby's flexibility, assorted Ruby libraries, etc.
However, performing such a conversion in a single step is risky, because multiple translation errors may conspire to complicate debugging. Fortunately, it is possible to move projects in an incremental manner.
Preparation
- Make a copy of an existing project.
- Modify the copy to link against the MacRuby framework.
- Copy in main.m from an existing MacRuby application (change).
- Copy in rb_main.rb from an existing MacRuby application (addition).
- Add a build phase that copies *.rb into the Resource directory of the application bundle.
- Try out the copied project, to make sure it still runs properly.
Coding Changes
- Convert a file from Objective-C to MacRuby.
- Create SomeClass.rb, corresponding to SomeClass.[mh].
- In SomeClass.rb, define a replacement method (and class, if need be).
- Comment out the Objective-C method.
- Try out the new method, to make sure it still runs properly.
- Once an Objective-C file contains only comments, it can be removed.

