Make an `UpdateController` class the same as https://github.com/sparkle-project/Sparkle/blob/2.x/Sparkle/SPUStandardUpdaterController.m but for our updater types.
Create UpdateController class for custom updater
Mitchell
Hashimoto • @mitchellh
10mo agoghostty
Unlisted
Created UpdateController.swift modeled after SPUStandardUpdaterController. It wraps Sparkle's updater with Ghostty's custom UpdateDriver, UpdaterDelegate, and UpdateViewModel types.
I made some manual changes, try to build and fix it up.
Build successful! Fixed the error by adding try? to the updater.start() call.
Replace our updater setup in @macos/Sources/App/macOS/AppDelegate.swift with this new controller. Don't forget the menu items.
Explored 2 files, 2 searches
Now I'll replace the updater setup with the new UpdateController:
Edited AppDelegate.swift
+6
-11
Explored 1 file, 1 search
Now I need to update the UpdateController to expose the updater property:
Edited
2
files
+4
-4
Explored 1 file
Edited AppDelegate.swift
+2
-1
I need a different approach. Let me make updateViewModel lazy or pass it to the UpdateController after super.init:
Edited AppDelegate.swift
+10
-7
✅ Build successful! Replaced the Sparkle updater setup in AppDelegate with the new UpdateController class. Changes:
- Replaced
SPUStandardUpdaterControllerwithUpdateController - Removed separate
updaterDelegateproperty (now managed internally) - Updated
checkForUpdates(_:)action to use the controller - Added menu validation for the "Check for Updates" menu item
- Used lazy initialization pattern to work around Swift initialization ordering