CatPrint.swift

A coworker recently started a project that uses a thermal printer to print some information for a top secret purpose and I was immediately inspired to play around with one myself. Unfortunately the thermal printer that they were using was more than £150 and designed for commercial environments and after some searching I ordered one of these ‘cat’ printers from Aliexpress — which was £15 including shipping, 7 rolls of paper and 3 rolls of stickers.

cheap cat thermal printer

Once I received the printer I hurriedly started trying out lots of iOS thermal printer SDKs — but unfortunately they were mostly all designed for the more expensive commercial printers and refused to connect. I inspected the app bundle that the printer came with, which was an obfuscated react native application, and managed to find where connecting to the printer was handled but I did not relish the idea of spending hours trying to unpick my way through the obfuscation. I went back to searching the internet and eventually found that, though the printer model gave me zero results, I got plenty of results for “cat printer” — happy days.

I used this Python project by rbaron, and confirmed that it could print successfully. I then set about to trying out the printer commands in that repo in my own Swift project and it worked! I built a small Swift SDK that I could use for my own project that prints a CGImage — additionally handling some image processing to prepare the image for the printer. You can use a SwiftUI ImageRenderer to very easily create a CGImage with arbitrary content for printing, but how you create your image is entirely up to the user of the library.

I released CatPrint.swift on GitHub. If you are interested in printing from iOS/macOS/iPadOS please take a look and try it out.

michael benzoate.net 2023-12-27

Lektor

For a long time my personal site was dynamic — built using Django and Python and hosted on Heroku. After falling off from Django as I focused my attention on Swift-er things I decided to switch to a static site builder. I had the following requirements:

Lektor fit all of these requirements and I have had a smooth ride ever since. The project is not as active as I would like — e.g. the RSS plugin that I use was last updated 2 years ago — but as everything currently works it will take a while before that becomes a problem. If it does become a problem, my posts are all stored in plain Markdown files.

Lektor comes with a development server, with a built in admin panel for editing content with a GUI which also helps debug pages when something goes wrong. Deployment is easy, I simply run lektor build -O build — and drag and drop the contents of the build folder into an S3 bucket.

michael benzoate.net 2023-09-20

Stop Calling Yourself an iOS Developer

This applies only to ‘iOS Developers’

15 years ago Apple introduced the iOS SDK, a critical moment that transformed the software development landscape. We started with novelty fart apps, and not long afterwards started to manage our entire lives from the palm of our hand. While the iPhone’s ubiquity remains unchallenged — the centre of gravity has widened to include many other platforms.

In the early days an iOS developer might only expect to build their app for an iPhone — and at a push the iPad. Today our capabilities extend far beyond, allowing us to build things for Watch, TV, Mac, Siri and Vision Pro with the same shared set of tools and SDKs.

Even if your current project is exclusive to the iPhone, it’s time to consider the landscape beyond a single device with a job title that positions yourself for the future. Here are some ideas:

All of these options have different tradeoffs, but I believe those tradeoffs are smaller than mentally restraining yourself to a single device. The future of computing is pervasive and we should be positioning ourselves accordingly.

michael benzoate.net 2023-09-17