I like playgrounds. They’re great for learning, teaching, and documenting, but they’re not so great for building apps. I want the ability to have playground features (a sidebar with values, etc.) while I’m coding my app, e.g., while I’m editing my ViewController.swift file. I shouldn’t have to copy & paste between my MyPlayground.playground file and my ViewController.swift file. It should all just be in one file.
Storyboard & Interface Builder
The same idea goes for Storyboard & Interface Builder. Just as playgrounds shouldn’t need separate files to work, Storyboard & Interface Builder shouldn’t need separate files to work either. It should all just be in one file.
Storyboard should’t manage and change a separate storyboard file. Get rid of that! It should analyze my app’s code, see how everything’s connected, and show me a corresponding visual.
Analogously, Interface Builder should’t manage and change a separate nib file. It should analyze my file’s code and visualize it.
Imagine my app’s code & a corresponding visual side-by-side: my code on the left, and the visual on the right. The visual has two modes: Storyboard & Interface Builder. As I change my code, the visual changes in real time to match my code. And, as I change the visual, say by adding a segue in Storyboard mode or by moving a button in Interface-Builder mode, my code changes in real time to match the visual. Xcode could even highlight which parts of the code are changing.
Keep It Simple
Sure, one day, it’d be nice if we didn’t have to write code at all. But, for now, we need code because that’s how we express logic, manipulate data, etc. So, although we can’t get rid of the code just yet, let’s at least get rid of the extra code generated by Storyboard & Interface Builder. Let’s keep it simple, guys! (I know doing what I’m proposing is more complicated, but it would make building apps easier. And that’s genius: taking something complex and making it simple. “Simplicity is the ultimate sophistication.”) I’m all for visual development, but let’s not move backward. Let’s move forward. Get rid of those extra Storyboard & Interface Builder files, and get rid of all that extra XML code.
Inventing on Principle
As with all ideas I have, those above aren’t mine. I got them by watching a legendary talk by Bret Victor titled “Inventing on Principle” and by continuing to use Xcode, wishing it worked as Bret had suggested.
I realize that adding playgrounds was likely Xcode’s response to Bret’s ideas. I salute such efforts, but as I’m sure Bret would agree, playgrounds don’t quite cut it. Fundamentally, playgrounds shouldn’t be separate from my project. The should be integrated. My project should be a playground.
Adapt or Die
I still prefer building iOS apps entirely in code. I know some developers like using Storyboard & Interface Builder, but until those work with my code, instead of with separate files, I won’t use them. The same goes for playgrounds, although I sometimes use those (albeit very rarely) for instruction & experimentation.
If Xcode doesn’t do this, another team will, and such an experience, if executed well, would put Xcode to shame. Let’s just say the cost of acquiring a company that does this would be significantly greater than the actual cost of building it.
With that in mind, if anyone’s interested in building such a truly integrated experience, hit me up. We could put together a legendary team of individuals. The first version, or minimum viable product (MVP), could just analyze code and show a corresponding, real-time-updating user interface. This would be valuable for those like me who prefer to build everything, including user interfaces, programmatically.