一个简单的 macOS 应用程序更新器,每天检查您的 GitHub 发布版本中的二进制资产,并在后台静默更新您的应用程序。
\(reponame)-\(semanticVersion).ext
。你好,我是 Max Howell。我是一位多产的开源软件开发者,您可能已经使用过我的一些作品(例如,我创建了 brew
)。我全职从事开源工作,这很辛苦;目前我的收入低于最低工资。请帮助我继续我的工作,我非常感谢 🙏🏻
package.dependencies.append(.package(url: "https://github.com/mxcl/AppUpdater.git", from: "1.0.0"))
然后
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
}
}
}
}