Pastecard for iOS

Pastecard now has a native iPhone app. This is a big departure from the product philosophy of prioritizing a web app experience that works—without a login or password—on anything with a modern browser. Before I get to why I made it, I should mention it is not available in the App Store. You have to download the source from Github, create a project in Xcode, and install it on your phone over a USB cable. This is mainly because Apple charges $99/year1 to put apps in the App Store, whether they make money or not. And Pastecard most certainly does not. Furthermore, it would make this small side project feel much more serious and potentially open up my lazy programming to more competent malfeasants.

So why make it at all? Well, it’s arguably the best way for me to learn a new programming language, because I know every piece of what the app is supposed to do and how it’s supposed to look and feel as it does it. And now, Swift is now the third language Pastecard has been written in, after JavaScript and HyperTalk. Did I end up really learning Swift? Absolutely not. My process had three steps:

  1. Watch some free online videos of how to lay apps out in Interface Builder and connect interface elements to code. Constraints, outlets, and actions, baby!
  2. Rewrite the JavaScript for each function in remedial Swift. Let Xcode automatically correct the errors it can, Google the answers to the rest (which are almost always on Stack Exchange).
  3. Run the app in the simulator, try all test cases I can think of, go back and repeat step two until it feels right.

My programming knowledge and experience have marginally increased from their low initial levels as a result. I don’t really know JavaScript, either.

Another reason to make a native app came up as I went. The Pastecard web app uses two separate technologies to function offline: local storage and app cache. The former is how the user’s card text is stored on the device, and the latter is how the web app itself is “installed” on the device. And pretty much the entire time Pastecard has supported going offline, app cache has been a deprecated technology and strongly advised against. Whoops!

The replacement for app cache, service workers, I purposefully ignored because they weren’t supported in Safari. I am at least half of the Pastecard user base, and I exclusively use Safari! This conveniently let me ignore also that service workers require https, a rabbit hole of time and expense.2 And then, as I worked on the iOS app, the Safari beta added support for service workers, all but signaling that its next major version in 2018 will support them (and maybe stop supporting app cache at the same time). So by the end of the year, I foresee a fork in the road of either rewriting the web app to support service workers, or removing the ability for the web app to function offline altogether—on iOS and Android—and asking people to use this new app instead on their iPhones. (Android people would have to make sure their phones were always online. Sorry.)

In summary, I fumbled and bumbled my way through recreating Pastecard as a native iOS app. It began as a learning exercise and may end up the default way to use Pastecard on iPhones, despite my best wishes. Software development is a mystery.