Last active
May 5, 2021 15:18
Sparkle + SwiftUI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lass AppUpdateHandler: ObservableObject { | |
#if SPARKLE | |
private let delegateHandler = SparkleDelegateHandler() | |
let sparkle: SPUStandardUpdaterController | |
init() { | |
// Setup sparkle updater | |
// https://docs.microsoft.com/en-us/appcenter/distribution/sparkleupdates | |
// https://rambo.codes/posts/2021-01-08-distributing-mac-apps-outside-the-app-store | |
sparkle = SPUStandardUpdaterController(updaterDelegate: delegateHandler, userDriverDelegate: delegateHandler) | |
} | |
func checkForUpdates() { | |
// https://sparkle-project.org/documentation/ | |
sparkle.checkForUpdates(delegateHandler) | |
} | |
private class SparkleDelegateHandler: NSObject, SPUUpdaterDelegate, SPUStandardUserDriverDelegate { | |
func feedURLString(for updater: SPUUpdater) -> String? { | |
"https://api.appcenter.ms/..." // or whatever you use | |
} | |
} | |
#endif | |
} |
typo: *class
Question: Do we need to build a macOS plugin for Sparkle like this example?
Yes, you need to follow the 2.0 integration guide.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
in your main app