Interface Builder

From Mac Guides

Jump to: navigation, search
Interface Builder 3.X Icon
Interface Builder 3.X Icon
Interface Builder 2.X Icon
Interface Builder 2.X Icon

Interface Builder was a separate application included with the Xcode version 3 Tools. It is used by developers in combination with Xcode to design interfaces for both Carbon and Cocoa applications. As of Xcode 4, Interface Builder is now integrated into the main Xcode window.

Interface Builder stores data in "nib" files, which stands for "NeXT Interface Builder". They can include menus, windows, classes and more. Controls are added to windows from palettes and connected to classes using drag and drop, with Interface Builder being one of the first commercial applications to offer this feature.

The Mac OS X version of Interface Builder uses a feature called Aqua Guidelines to automatically snap controls to locations at recommended distances from other controls and boundaries, in accordance with the Aqua Human Interface Guidelines. It is therefore very easy to produce interfaces that thematically match the rest of Mac OS X.

Actions and Outlets

A key part of understanding Interface Builder when creating a Cocoa application is understanding actions and outlets, and how these are used to connect your program code to the user interface. Carbon interface files do not have actions or outlets.

An action is an Objective-C message (similar to a C++ or Java method) sent to a class when the user does something like click a button or change a tickbox.

An outlet is a pointer to a GUI object that allows program code to affect its state - for example to disable or enable some options in a preferences dialogue depending on the user's other selections.

The classes a programmer intends to use for GUI interaction can be defined in Interface Builder and all actions and outlets can be named and graphically connected to classes. The next step in the typical software development cycle is to have Interface Builder produce header and implementation files and add them to an existing XCode project so that the application specific code can be added.

Using Interface Builder a trivial application such as a calculator can be produced with only around 100 lines of code.


Interface Builder is an evolution of a program developed on the NeXT platform. Steve Jobs wanted an application that allowed anyone to more easily build applications, and so Interface Builder was created. Prior to that point, creating an application involved programatically laying out a user interface, or using much cruder tools, such as ResEdit.

Interface Builder quickly became a primary tool in NeXT application development, and following Apple's aquisition of NeXT, Interface Builder became the primary tool for designing GUI interfaces for almost any Mac application in use today.

An interesting bit of trivia is that Tim Berners-Lee used Interface Builder to create WorldWideWeb 1.0, the very first ever internet browser - creating a simple start to a global technology that rivals the Telephone. That "www" in almost every internet URL owes itself to an application developed with the help of Interface Builder.