Rendering Playground Views

Screen Shot 2015-06-15 at 2.19.45 AM

As I continue to work on playground book prep, I decided I couldn’t live without perfectly rendered playground value history and XPC live view caps. Instead of using a screenshot-trim approach, I figured I could render views directly to disk.

I expanded my Xcode word-wrap plugin to add a new Dump Views option. This menu choice performs a recursive descent of the IDE workspace to find instances of DVTControllerContentView and IDEToyHostingView_timeline. It saves view snapshots to a folder on my desktop

Screen Shot 2015-06-15 at 2.23.28 AM

Interestingly, my preliminary rendering was a little wonky for simulator-supported XCPShowView results. This only happens for iOS simulator-driven presentations and I suspect its is because iOS-native graphics use a top-left origin vs the bottom-left Quartz system.

fooI’m pretty pleased with the results, so here’s a post to document the specific view classes. Hopefully it can save someone else some work beyond googling.

If you’d like to really explore Xcode at a deep level, John Holdsworth has done some master work on the subject. Check out hits Xprobe repo over at github.  He writes, “Welcome to the club of those that hack Xcode. Xprobe allows you to browse around the Xcode internals presented as a web page. Load up the plugin then load a project and use “Product/Xprobe/Xcode” as a start. Click on the links to view the objects/properties/method.”


  • Do you think this same approach could be used to make a GIF of animated live views in playgrounds? Would be awesome to have a “Capture as GIF” option on playgrounds.

    • There are no technical obstacles as far as I can see but wouldn’t it be a lot easier just to use a screen capture app?