Xcode 5 has a great new feature where you can hover over a variable name and get a visual representation of a UIColor, UIImage, or even UIBezierPath.
I vaguely remember a comment at WWDC where developers could either conform to some protocol or override some methods on any NSObject subclass in order to participate in this new debugging feature. I would love to add this to a bunch of my model objects to help me debug. Anyone know whether this is a real thing yet, or even if they hinted at it in a future release?
Unfortunately, Apple refers to this feature as "Quick Look" and since they have another technology called "Quick Look" my search results are very noisy and I can't find anything helpful.
This is a new feature in Xcode 5.1, and the documentation on it can be found here. In a nutshell, you override -(id)debugQuickLookObject
and return an OS type that already supports Quick Look, e.g. UIImage or NSAttributedString (full list of types in documentation):
- (id)debugQuickLookObject
{
UIImage *image = [...];
// Drawing code here
return image;
}
For Swift:
There are a few options as of writing, none ideal: