Curious how Apple created their interactive Swift playgrounds, which included embedded code and documentation?
Matt Mathias of Big Nerd Ranch provides some insight:
In this post, I will show you how to peek inside the .playground file to gain a sense of how a Playground is put together. Glancing at these internals will help you to create your own interactive document.
When accommodating iOS 7 users, you’ll inevitably run into instances where you need to check which iOS version the device is running, so that you can implement a fall-back plan for older versions of iOS.
In Objective-C, I’ve seen this accomplished by using pre-processor directives, or with introspection. Swift, however, has no pre-processor directives in v1.0…
As Andrew demonstrates, you can use NSFoundationVersionNumber for both Objective-C and Swift.
SwiftStub is an online Swift Read-Eval-Print-Loop (REPL).
One of the features that make this REPL unique is the option to collaborate with another developer in the same playground.
Skip Wilson is the creator of SwiftStub:
With the production release of iOS 8, Xcode 6.01 is now available.