Contentful Documentation Playground

With Xcode 6 and Swift, Apple also released a new feature called Playgrounds, which allows one to interactively try out code and it is also possible to integrate it with documentation. As this is pretty similar to what we do in the JavaScript documentation of Contentful, it sounded like a good option to improve the usefulness of the iOS documentation.

Unfortunately, it is not so easy to integrate custom frameworks with Playgrounds at this point in time, as it is unsupported by Apple, so investigating this actually spawned a talk at this month's NSLondon meetup which goes in depth on how Playgrounds work. The main issue to overcome is that Playgrounds are not executed inside the Xcode process itself, so it is rather difficult to manually load custom frameworks into them. Both processes communicate via a network protocol with each other to further the separation. You can find the slides here and a video recording of the talk in a few days. There was a follow-up talk at SwiftCrunch and you can find the slides for that here.

The result of it is the Xcode plugin BBUToyUnboxing which allows you to easily use custom frameworks in Playgrounds. The easiest way to install it is running this command in your Terminal:

curl -fsSL | sh

This will install the plugin, the Contentful Delivery API framework for OS X and two example Playgrounds, which you can see in action in this video:

You can of course also checkout the code of the plugin on GitHub or install it via Alcatraz.

Using Xcode Playgrounds offers a much better way to explore the Contentful APIs then previously possible and also allows you to easily see how to use the SDK from applications written in Swift.

Blog posts in your inbox

Subscribe to receive most important updates. We send emails once a month.