Last active
May 5, 2021 15:18
-
-
Save steipete/450e1f2ec439df0a3a4b3578b46f4e42 to your computer and use it in GitHub Desktop.
Sparkle + SwiftUI
This file contains 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 | |
} |
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
typo:
*class
Question: Do we need to build a macOS plugin for Sparkle like this example?