https://github.com/exelban/updater
A tiny package that adds an update process to your project
https://github.com/exelban/updater
github ios macos mechanism release swift update
Last synced: 4 months ago
JSON representation
A tiny package that adds an update process to your project
- Host: GitHub
- URL: https://github.com/exelban/updater
- Owner: exelban
- License: mit
- Created: 2020-09-25T20:11:33.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-12-25T07:59:31.000Z (about 4 years ago)
- Last Synced: 2025-07-06T21:08:10.344Z (7 months ago)
- Topics: github, ios, macos, mechanism, release, swift, update
- Language: Swift
- Homepage:
- Size: 22.5 KB
- Stars: 7
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Updater
A tiny package that adds an update process to your project
## Install
### Swift Package Manager
Add `https://github.com/exelban/updater` in the Swift Package Manager tab in the XCode.
## Usage
First of all, you need to initialize the Updater. You need to pass providers to the init function that will be used to fetch updates:
```swift
let updater = Updater(name: "Stats",
providers: [
Updater.Github(user: "exelban", repo: "stats", asset: "Stats.dmg")
]
)
updater.check() { result, error in
if error != nil {
print("error updater.check() \(error!)")
return
}
let local = Updater.Tag(Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as! String)
guard let external = result else {
print("no external release found")
return
}
if local >= external.tag {
return
}
self.updater.download(url, done: { path in
self.updater.install(path: path)
})
}
```
## Supporting providers
Originally this package was designed to work only with Github Releases. But now it supports different providers:
- Github Releases
- Custom server (TODO)
## License
[MIT License](https://github.com/exelban/updater/blob/master/LICENSE)