nil}2021-02-05T00:00:00-09:00{"modified_time"=>nil}" />


Advent of Code 2020 on Swift Playgrounds for iPad
Andrew McKnight – 5 February 2021

I tried Advent of Code for the first time this year. Very fun–scratched my itch for the odd programming challenge, comes with a storyline that got me personally, emotionally invested.

I decided that I’d confine myself to using iPad Playgrounds to write my solutions in Swift. I’d used it a few times a couple years ago and liked what I saw, thinking it had great potential. My most memorable session was riding a ski bus to the mountains: I worked out an algorithm for snapping angles to intervals around a unit circle, and enjoyed the visualizations it offered, like graphs of variable values in loops. Those seemed like the perfect tool to attack code challenge problems.

I used an iPad Pro 10.5” with  Smart Keyboard (my second one in as many years, by the way; and my down arrow key is already going in this one!). I did not use a Magic Mouse, although I do from time to time on the iPad; just haven’t made it a habit. It probably would have helped with a lot of the minor editing issues, although I wasn’t always in a situation that’d allow it. In general, I do prefer key-based control over mousing and clicking, so I always appreciate a robust set of hot key combinations.

As I moved through problems, I started writing down annoyances I encountered. Eventually, I started to dread using the app and felt it was hurting my inaugural AoC experience, and ended the experiment after about 7 days. I don’t hate the app; I’ve previously covered some things I love about iPad Plagrounds and how it’s a glimpse of next-gen IDEs. I just have high expectations of Apple and am a disappointed that it hasn’t evolved in the intervening years.

After moving to Xcode, I felt like I was moving at warp speed. I now have unit tests that run my solution code against expected answers, and even a command line application target to generate all the boilerplate for next year’s competition.

I did not finish the competition, although I may continue to work on problems throughout 2021. I really enjoyed my first AoC and am grateful for the perspective I got taking deep dive in Playgrounds: I really appreciate all the little things a modern IDE provides. All the associated code lives in a GitHub repository.


As I said earlier, there are plenty of other things to love about Playgrounds besides this short list. These are just the new things I noticed this time around.


OK. This is a long list. I split these into small potatoes like simple bugs or oversights, and big fish: things that were probably considered but represent large efforts to complete and so have been put on the back burner.

Small Potatoes

Big Fish

You Must be This Tall to Ride

I’ve been checking in with Swift Playgrounds since its infancy. I’m hoping that soon we’ll see it grow up into a mature code editor, or even a new state-of-the-art IDE by being reincarnated as Xcode on the iPad–one can dream! Whether part of making that dream a reality, or just improving the Playgrounds app, I hope some of the things I listed here are on the roadmap, or find their way there, provided the right people see my feedback. It’s undoubtedly a good tool to teach Swift to a new programmer. Could it–should it–become worthy of editing real-life production code?

🙏🏻 Enjoy the post? Please help support more like it by buying me a cup of coffee!.

💡 Suggestions, questions, comments? Please submit a PR!.