iOS/Mac developer, designer,
game creator, biker guy
November 3rd, 2016
« Previous | Next »

Xcode: Quick Look Anything
by Matt Reagan
Xcode's Quick Look debug tool, first introduced in Xcode 5.0, added a convenient way to inspect images, colors, strings, bézier paths, and other common data types while debugging your iOS or macOS apps.

However, not all objects will be conveniently listed in the debug area or in your source files, and at times you may wish to quickly view an image or other arbitrary data you only have referenced by a memory address.

One easy way of doing this is to add an expression in Xcode to represent that object, which you can then Quick Look.

How It's Done

1. Right-click in the debug area, and choose Add Expression...

2. Create an expression for the pointer, it can simply be a typecast memory address
Objective-C: (UIImage *)0x6080000851e0
Swift: unsafeBitCast(0x6080000851e0, as: UIImage.self)

3. Your reference is now listed in the variable area. Select it, and click the Quick Look icon
4. ...and voilà, a Quick Look of any object by its memory address

Custom Types

For more fun with Quick Look, take a look at Apple's documentation on how to add Quick Look support to your own custom object types. NSHipster also has a great article exploring this in further depth.


Thanks to Mike Ash for pointing out the availability of unsafeBitCast().