[MacRuby-devel] MacRuby on Mavericks

Joshua Ballanco jballanc at gmail.com
Wed Nov 13 23:58:22 PST 2013

On Sunday, November 10, 2013 at 8:16 AM, Robert Carl Rice wrote:
> On Nov 7, 2013, at 9:07 AM, Joshua Ballanco <jballanc at gmail.com (mailto:jballanc at gmail.com)> wrote:
> > * MacRuby integration with Xcode relies on rb-nibtool, but the Xcode team has repeatedly signaled (not so subtly) that they are not interested in keeping this shim working.
> I assume that rb-nibtool scans rb files to identify possible IBOutlet and IBAction targets. If this is it's only function then I would not miss it if it goes away.

Yes. In fact, the only real benefit that rb-nibtool brings is that it would run automatically (i.e. without the need for user interaction) to update the list of IBOutlets and IBActions every time you fired up interface builder. A while back some of us on the team played with the idea of a tool to automatically generate header files as you've done manually, but the problem is that you'd still need to explicitly run it every time your ruby file changed (or use something fun like "kicker" to run it for you on file change notifications).
> I have discovered that it is easy to define IBOutlet and IBAction targets in Objective-C files without recoding any ruby code into Objective-C. The results are much better because the linkage and error messages are very fast while the scanning of ruby files gets very slow on a large project.
> To avoid adding a lot of files, I created a single Objective-C .h and .m file for each of my nib files, including the main, giving it a corresponding name.

In fact, you should be able to get away with just the .h file and keep using the attr_* methods in your Ruby code. So long as nothing #imports the .h file, it has no impact on the build process, but it's presence in your Xcode project should be enough for Xcode's parser to generate the appropriate hooks for Interface Builder.



More information about the MacRuby-devel mailing list