IBObject, IBOutlet & IBAction

Three aspects are provided on the Cocoa platform to mark code for interaction with Interface Builder, the visual UI designer in Xcode. You can read more about working with Interface Builder, and XIB and Storyboard files in the Working w/ XIBs & Storyboards and Editing Cocoa UI Files in Xcode topics.

The IBObject aspect marks a class as exposed to Interface Builder, and also excludes it from name mangling, to ensure that the class can be found under its given name by the Objective-C runtime.

In general, every View Controller or Window Controller class should be marked with this attribute, and also any other class that you want to make connections to in Interface Builder (for example, your AppDelegate class, in a macOS application).

The IBOutlet aspect marks a property as outlet, and lets it be hooked up to a visual control or other object in Interface Builder. In Swift, it also implies additional nullability constraints, in that the outlet must not be initialized in code, and can still be declared as non-nullable.

Finally, the IBAction aspect marks a method to be available to connect actions to, in Interface Builder.

Cocoa Only

The IBObject, IBOutlet and IBAction aspects are available on the Cocoa platform only.

See Also