Remove IB plugins from Xcode

Xcode 4 reached the final version, stability has somewhat improved but no signs of support for Interface Builder plugins. I decided to keep Xcode 3 in a separate location, just to edit the xib file where I was using IB plugins, but this is impractical:

  • If you use several Macs, having two Xcode versions on each one of them is quite cumbersome; nothing worse than finding out that you need Xcode 3 and you only have Xcode 4 on your laptop… Even with a fast connection, downloading the two versions takes a long time. Yes, you need both the installers: installing Xcode 3 will break Xcode 4, even if you install it in a different folder; you must install Xcode 3 first, and Xcode 4 after;
  • Whenever you change the code of some files referenced by your xib, you need to open the entire project again in Xcode 3, or Interface Builder won't be aware of the changes (you won't be able to use new outlets or actions for example); this is no big deal, but it can quickly become messy. Just an example: if you add files in Xcode 4, Xcode 3 won't be aware of them.

Finally I decided to remove all dependencies from the IB plugin I was using. I was using the Shortcut Recorder framework in my application: if this is your case, removing IB plugins is a fairly simple task.

The idea is simple: instead of directly using the SRRecorderControl object directly (which is a plugin), just use the class it is derived from, so Xcode 4 will be able to open the xib.

Just follow these steps, and you won't need Xcode 3 any longer:

  1. Open your xib file in IB3 (this is the last time you will need it);
  2. Select the object using an IB plugin (SRRecorderControl in my case);
  3. Jot down all important information:
    • Size and position;
      Recorder Control Size 2
    • References (delegate, outlets, etc.);
      Recorder Control Connections
    • Name of the object's class (i.e. SRRecorderControl);
  4. Check the parent class name (NSControl in my case);
  5. Delete the object;
  6. Add an instance of the parent class;
  7. Change the class name to the correct one (i.e. SRRecorderControl);

    ShelfMenu Preferences
  8. Add all other pieces of information that you noted earlier;
  9. Save the file;
  10. You are done: you can now close IB 3 and you will be able to open the file in Xcode 4.

If your plugin is more complex and you are using advanced features this won't be sufficient, and you will have to adapt the code, but in the simple case of Shortcut Recorder this does the trick.