For our Slido integration with Microsoft PowerPoint on macOS we used the Sparkle library to do automatic updates of our main Slido application. Our code also runs inside PowerPoint and we need to do checks if new versions are available. Unfortunately we cannot use the full Sparkle framework because of technical limitations for add-ins running in Office apps on macOS.
Sparkle framework uses the Appcast format for updates. This is an RSS document with additional Sparkle data to facilitate minimum system requirements, critical updates and delta updates information. Sparkle is written in ObjectiveC language and it does not provide a library target just for the Appcast implementation in their Swift package definition.
Our app and addin code is written mostly in Swift and we would prefer to integrate a Swift code for parsing Appcast documents. The authors of Sparkle project would like to keep it Objective C only for compatibility with very old OS X versions. Otherwise we would provide class-by-class migration from Objective C to Swift pull requests back to the Sparkle project.
Individual library
I have decided to write a new Appcast parsing library in pure Swift. The original Appcast code is very stable so the new library can be kept compatible with Sparkle code.
The RSS format and Sparkle extensions are quite simple and the original Appcast code in Objective C is small so rewriting it in Swift was easy.
The first
preview release will parse the Appcast document and provide simple data in
the AppcastItem
structure. This proves we can create modern library
which works in our Slido
integration with Microsoft PowerPoint.
Integration tests
Sparkle framework has a large integration tests suite for parsing Appcast files. Their integration tests are in a single large test suite. To get better picture about features implemented in the new Appcast library I had to refactor large tests into small test function focused to just do single and focused checks.
I have followed the Definition of a Unit Test from Roy Osherove when refactoring tests. The The Art of Unit Testing book is a great guide for writing tests, refactoring legacy code and ensuring the trustworthiness of tests.
Refactoring of tests is available in the slidoapp/Appcast@test/appcast
branch.
What's next?
The new library needs to implement the same logic for resolving the best available update in the Appcast file to match the behavior of Sparkle framework. As we don't need the delta updates (our DMG is just 8MB large) we will skip implementing information about delta updates in first releases.