Quick overview of Swift Playgrounds in iOS Simulator
March 16, 2015
Probably lately you’ve seen few posts on this subject like this or that. Both of described techiques share the same secret - how playground is run in Simulator. Actually it’s quite easy, but not obviouse as all windows needed for that are hidden by default - you just need to open up File Inspector for your playground file, select iOS platform and check “Run in Full Simulator”. This will run iOS simulator and run your playground almost like ordinary application.
But this techniques differ in a way they present “interactivity” of playgrounds. The latter uses XCPlayground framework to render views directly in timeline. This can be usefull for fast prototyping of views and animations.
The former renders playground in iOS simulator and actually let you interact with it using touch events. It uses CFRunLoopRun() to start run loop and make app alive and responsive. I find this more powerfull - you can prototype not only views and animations but the whole screens, transitions and many other things that you can do in real application. All you need is just a boilerplate code for window setup, which you can place in snippet. I’ve created basic gist to demonstrate that technique.
Both of these techniques are still very unstable (just like playgrounds in general), they break often, restart slowly and have issues. But it’s very interesting opportunity for experiments. Maybe there will be time when we always will start developing new features in playgrounds.
This is quiet interesting XCode feature I was not aware of until last week. Maybe you will find it not so interesting and definitely will not use this on…
Custom UITextView in Swift
In this article I want to describe how I developed custom UITextView component in Swift using TextKit, Playgrounds and IBDesignable and IBInspectable directives…