A simple app-updater for macOS, checks your GitHub releases for a binary asset once a day and silently updates your app.
\(reponame)-\(semanticVersion).ext
.Hey there, I’m Max Howell. I’m a prolific producer of open source software and
probably you already use some of it (for example, I created brew
). I work
full-time on open source and it’s hard; currently I earn less than minimum
wage. Please help me continue my work, I appreciate it 🙏🏻
package.dependencies.append(.package(url: "https://github.com/mxcl/AppUpdater.git", from: "1.0.0"))
Then:
import AppUpdater
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
let updater = AppUpdater(owner: "your-github-username", repo: "your-github-repo-name")
//NOTE this is optional, the `AppUpdater` object schedules a daily update check itself
@IBAction func userRequestedAnExplicitUpdateCheck() {
updater.check().catch(policy: .allErrors) { error in
if error.isCancelled {
// promise is cancelled if we are already up-to-date
} else {
// show alert for this error
}
}
}
}