Simplify programmatic example (#94)

This commit is contained in:
Zorg
2021-10-24 00:05:47 -07:00
committed by GitHub
parent 3bcc323280
commit 492c59e271
+11 -8
View File
@@ -14,16 +14,19 @@ import Sparkle
@NSApplicationMain
@objc class AppDelegate: NSObject, NSApplicationDelegate {
@IBOutlet var checkForUpdatesMenuItem: NSMenuItem! // Hooked up in Interface Builder
let updaterController = SPUStandardUpdaterController(startingUpdater: false, updaterDelegate: nil, userDriverDelegate: nil)
// Hook up menu item outlet in Interface Builder
@IBOutlet var checkForUpdatesMenuItem: NSMenuItem!
let updaterController: SPUStandardUpdaterController
override init() {
// If you want to start the updater manually, pass false to startingUpdater and call .startUpdater() later
updaterController = SPUStandardUpdaterController(startingUpdater: true, updaterDelegate: nil, userDriverDelegate: nil)
}
func applicationDidFinishLaunching(_ notification: Notification) {
checkForUpdatesMenuItem.target = updaterController
checkForUpdatesMenuItem.action = #selector(SPUStandardUpdaterController.checkForUpdates(_:))
// SPUStandardUpdaterController was instantiated by not starting the updater automatically
updaterController.startUpdater()
}
}
```
@@ -34,7 +37,7 @@ If you use another UI toolkit, these are the relevant APIs in Sparkle 2 for chec
* [-[SPUStandardUpdaterController startUpdater]](/documentation/api-reference/Classes/SPUStandardUpdaterController.html#/c:objc(cs)SPUStandardUpdaterController(im)startUpdater) or [-[SPUUpdater startUpdater:]](/documentation/api-reference/Classes/SPUUpdater.html#/c:objc(cs)SPUUpdater(im)startUpdater:) for starting the updater (unless it is specified to be automatically started)
* [-[SPUStandardUpdaterController checkForUpdates:]](/documentation/api-reference/Classes/SPUStandardUpdaterController.html#/c:objc(cs)SPUStandardUpdaterController(im)checkForUpdates:) or [-[SPUUpdater checkForUpdates]](/documentation/api-reference/Classes/SPUUpdater.html#/c:objc(cs)SPUUpdater(im)checkForUpdates) for checking for updates
* [-[SPUUpdater canCheckForUpdates]](/documentation/api-reference/Classes/SPUUpdater.html#/c:objc(cs)SPUUpdater(py)canCheckForUpdates) for menu item validation
* [-[SPUUpdater canCheckForUpdates]](/documentation/api-reference/Classes/SPUUpdater.html#/c:objc(cs)SPUUpdater(py)canCheckForUpdates) for menu item validation. This property is also KVO compliant.
If you are using Sparkle 1, you will need to use these APIs: