Using InterfaceBuilder 2.x or older
Unlike ObjectiveC projects where the user may simply drag+drop existing headers files of classes she wishes to expose in InterfaceBuilder, with RubyCocoa she needs to define the classes in InterfaceBuilder to make use of them.
- Launch IB.
- Select the 'Classes' tab and navigate to the the superclass you wish to create a RubyCocoa subclass of.
- Control/right click the superclass and select the 'Subclass NS<Name>' menu item.
- Name it (this must match your later RubyCocoa declaration).
- With your subclass selected, open the inspector (command-1) and add the desire outlets and actions.
- Instantiate or set it as the class for an existing element (eg: view) used in the nib.
- Wire it up (control drag from source to target).
- Write code to describe the subclass (alternatively, use the script mentioned below).
Alternatively, you can use the rb_nibtool.rb script, which you can find in the framework/tool directory of the RubyCocoa sources. Usage is simple:
$ ruby -r <any extra lib> rb_nibtool.rb --update --nib=SomeNib.nib --file=lib/SomeClass.rb
Using InterfaceBuilder 3.x or later
Newer versions of InterfaceBuilder are still under development and cannot be discussed here.