Updeto is a simple package that will help you to check if the currently installed version is the same as the latest one available on App Store.
Updeto
is available via Swift Package Manager
Using Xcode
go to File -> Swift Packages -> Add Package Dependency
and enter https://github.com/manasv/Updeto
The convenience API yet simple, has mainly two methods depending on your preference to retrieve the update status, either with Combine or via completion block.
If you are either on iOS / iPadOS, you will have access to a singleton that automatically retrieves the Bundle ID and App Version in your app.
Updeto.shared.isAppUpdated { result in
switch result {
case .updated:
// Do something
case .outdated:
// Do something
case .noResults:
// Do something
case .developmentOrBeta:
// Do something
}
}
Also you can create your own Updeto instance from the provided inits, requiring you to provide bundleId
and currentAppVersion
, you can optionally provide appId
if you already know the one for your app, or it will be written when the Appstore Lookup is made, so you can after that perform something with the URL like:
if let url = Updeto.shared.appstoreURL {
UIApplication.shared.canOpenURL(url){
UIApplication.shared.openURL(url)
}
}
Or whatever you want to do with the URL.
appstoreURL
is used, as right now if it's not set, is only a nil value.This is a undocumented API (or kinda API), so Apple may change it in any moment and the result may change, use it at your own risk, however I will try to maintain it as up to date as possible to bring the same functionality.
Hope you can find this useful, even if you can do what the library does without major effort, I aimed to bring it in a easy way for you.
link |
Stars: 8 |
Last commit: 48 weeks ago |
.developmentOrBeta
to the AppStoreLookupResult
in order to fix an issue where if the installed version is higher than the AppStore result it will throw .outdated
.Explanation of changes:
State that means installed version is higher than latest on AppStore. This is possible if the installed version is a development / beta build (eg. Xcode, TestFlight). Worst case scenario is that the response from apple is outdated, which is unlikely to happen.
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics