February 28, 2020

Bookish Development Diary, episode 7.

Ok, I admit it, I fell down a bit of a rabbit hole a couple of weeks ago.

Quite a lot of my open source packages have some sort of unit tests, and I’d been using Travis-CI as a way of running them, with CCMenu to monitor them locally.

Recently though I’ve been experimenting with Github Actions instead of Travis. They work really well, and I think I’m going to switch over to using them for everything.

The one thing I miss though is CCMenu. So I decided to see how quickly I could hack together a replacement. It was also an excuse to play around with SwiftUI…

Fast forward a few days and I have something working. It’s pretty simple, but nice I think, and works on iOS/tvOS and macOS, thanks to Catalyst. It’s called Action Status, and I think I’ll actually put it into the app store.

Action Status Screenshot

A few developers might find the app useful, but it is also a good way for me to refresh my memory of the whole app store submission process, before doing it again with Bookish.

This post isn’t about Action Status though, it’s about something that I realised I needed to do for it, which turned out to be a bit tricky: adding Sparkle support.

I wanted to do this so that I could distribute the Mac version to friends for testing.

I initially thought that this would be easy, but then the penny dropped that since I’m using Catalyst, I can’t link directly to Sparkle, because it uses AppKit.

I found a way round this problem, but it’s a little invovled. Once I’d got it working (roughly) in Action Status, I thought I should go back and isolate just the Sparkle stuff, as it might make a good example for other people wanting to do the same thing.

The result of that process can be found here.

If you want to know the full details, check out the repo’s read me.

Here’s the executive summary though:

You need to make a plugin, and have the plugin link with Sparkle.

Unfortunately Sparkle uses WebView in its UI, which crashes if used from an AppKit plugin in a Catalyst app. So you need to replace the Sparkle UI with your own.

One way to do this (which I chose to do), is to bridge Sparkle’s UI handling over the plugin and back into the host application. This means that the host has to make a custom UI for showing read me notes, updates, etc, but on the plus side, this means you can it funky. You can also use SwiftUI for it, if you are so inclined.

This was all an interesting, if unexpected, detour. A detour on a detour, in fact. However, I’m happy with the results, and I would have needed to do most of it anyway for Bookish since I’m using Catalyst there too.

« Fighting With UISplitViewController Github Actions and Swift »
Got a comment on this post? Let us know at @elegantchaoscom.