Making a case for Playgrounds on the iPad

Rumblings about Xcode for iPad have made their rounds about the Internet since a while. The driver in conceiving Xcode for iPad for me was that Xcode would make an ideal manifestation of the ‘Pro’ moniker, further pitch the iPad as a productivity device and serve as a handy tool for developers who’d appreciate the added portability.

Now I don’t know enough about how far Xcode is spread along all dimensions to state reasons why Xcode for iPad isn’t feasible — I’m still a beginner, writing Swift for iOS apps — but it’s obvious that Xcode for iPad — if it ever exists — cannot be an as-is port of Xcode on the Mac.

Instead, I’d like to make the case for Playgrounds for iPad and why I think it’s a competent solution to a lot of use cases:

  • Playgrounds are a very potent tool. Granted you’re not making an iOS app using Playgrounds anytime soon but you can definitely take your iPad with you to a coffeeshop to tweak the code that corresponds to that one screen of your iOS app, optimising your algorithm ever so slightly.
    For the app our team is working on, I needed to familiarise myself with Bézier Curves. All experimentation towards this purpose was done in a Playground. Once satisfied with what I wrote, I copied the relevant pieces of code to the original app.
  • Playgrounds are a really really powerful medium for learning Swift. Nearly every Swift tutorial I’ve come across that didn’t need to be an iOS app, was explained through a Playground.
    One of the reasons (the one that stood out to me the most) for this is that Playgrounds allow you to add stylised text (headings, lists etc.) and the output for functions, inline with your code. So, if you call a function add(2,3), the live output, in this case 5, can be displayed right under the line where the function was called. The official Swift blog has some pictures for illustrations.
  • This one ties in with the previous point. Playgrounds for iPad would serve as a huge proponent in Apple’s aims to make Swift ubiquitous. Apple has said it wants Swift to be everywhere and the language people use when programming for the first time.
    Those iPads at schools would make for excellent terminals for people new to programming to pick up coding on the iPad.
    (One could literally open Swift’s documentation and a Playground document in a split view to practice Swift.)
  • I’ve been talking about Playgrounds for iPad in the context of the iPad, visualising the 9.7-inch and 12.9-inch form factors. But what about the iPad Mini and the iPhone? Xcode for iPhone and iPad mini are a tough sell. Playgrounds are a natural fit.

Additionally, a Playground’s sandboxed and lightweight nature makes it an ideal fit for iOS’s design paradigms. I would even entertain the idea that Playgrounds may have been conceived with the iPad in mind.

(A few days ago Fraser Speirs tweeted about Pythonista’s capabilities. If you’re not familiar with Pythonista it’s a fully-featured IDE for Python. Fraser’s point was that those who think Xcode for iPad would be too complex should have a look at Pythonista. Again, I’ll steer clear of the arguments against Xcode for iPad but since Pythonista was on my wishlist for a while, I decided to buy it and fire it up. The instant I saw the first screen of code, I thought: This feels exactly like a Playground, for Python 1.)

Of course if Apple releases Playgrounds for iOS, more questions arise: UIKit would probably be included, but what about AppKit? What sort of precedent does this set for other apps on the App Store?

If you ask me, the prospect of learning and experimenting with Swift on my iPad is simply marvellous!

  1. A Pyground? Do excuse me. ↩︎

In Uncategorized by Mayur Dhaka