Why I rewrote my Swift app in Electron

I love Jupyter. It was my gateway to learning how to program in 2015. But I have always been frustrated by the lack of a native-feeling Jupyter application for macOS so I started developing my own Jupyter client, Satyrn.

Naturally, I started prototyping in Swift. I wanted a native-feeling and snappy macOS application, so what better language to use? Unfortunately, I ran into a roadblock which made me switch to Electron, the nemesis of many Hacker News and Reddit contributors. The roadblock in question: the Swift community lacks a rock solid production-ready code editor framework.

The most promising Swift code editor libraries I came across are CodeEditSourceEditor and CodeEditorView. Unfortunately both are far from production ready and lack many of the features I expect in a Jupyter client. I spent a few weeks trying to add the capabilities myself, but it became clear that it would take me 6-12 months to have something I was happy with, meanwhile making no progress on all the other features I wanted to build.

I started exploring alternatives to Swift, and did some prototyping in TypeScript. I immediately found the open source support for code editors in TypeScript/JavaScript is incredible. I know that might seem obvious as JupyterLab and VS Code build on open source frameworks, but I was still shocked by how easy they were to customize and use in my own project. Within a week I was able to prototype something that was better than my Swift app that I had spent months working on.

To build a desktop app with TypeScript you pretty much have two options: Electron or Tauri. My initial TypeScript prototype was in Electron, but I did spend a weekend trying to port it to Tauri. Unfortunately my Rust is… rusty, and there is a significant advantage to sharing code between the frontend and backend, so I decided to stick with Electron for my first production version of Satyrn. If people like it enough, I will end up porting it to Tauri to optimize performance and startup time.

Now Satyrn supports autocomplete, multi-cursor editing, and moving the cursor between cells just like you’d expect from JupyterLab or VS Code. Most recently I’ve added linting support. And there are many more exciting editor-based features coming to Satyrn soon. This has all been possible so quickly because I stand on the shoulders of giants, so thank you to the developers of Electron and CodeMirror.