About Variables Quick Look for Custom Types

The debugger in Xcode includes the variables Quick Look feature, a way to view variables in your app by displaying their contents graphically in a pop-up display. Quick Look lets you display a graphical rendering of object contents by pressing the Space bar with a variable selected in the debugger variables view.

At a Glance

The Xcode 5 debugger gave you the ability to dynamically visualize selected operating system class types with the variables Quick Look feature. This document addresses two important enhancements to this capability that were introduced with Xcode 5.1:

Together these two enhancements provide flexibilty in how you display your variables when debugging. To provide your custom class with a Quick Look display in the debugger, you provide a method for Quick Look to use in the object class. The method, called by Xcode, returns an object with a type matching one of the operating system classes supported by Quick Look display.

A customized Quick Look method for each of your custom object classes can be implemented, each rendering a live representation of the underlying variable in the way that makes best sense for the type. For example, a Person object could show an image of the person, or perhaps a map with a pin on a person’s home address, whichever is relevant to the implementation of the custom class in your context. You choose the operating system object type to return depending upon what best fits a rendering of your custom class objects.

See Also

Apple provides the following video presentations that show more about using the Xcode debugger: