AppFresh is a lightweight Swift library that checks for updates of an app on the App Store using the iTunes Lookup API, no self hosting required. It also provides a convenient way to open the App Store for updating the app.
- Fetch the latest app version from the App Store.
- Compare the installed app version with the latest version.
- Ensure the device meets the minimum required iOS version.
- Open the App Store page for easy updating.
- Open your Xcode project.
- Go to
File > Add Packages. - Enter the repository URL:
https://github.com/brustolin/AppFresh.git - Add the package to your project.
import AppFresh
import UIKit
func checkForUpdate()async{guardawaitAppFresh.hasUpdate()else{return}letalert=UIAlertController(
title:"Update Available",
message:"A new version of the app is available. Would you like to update now?",
preferredStyle:.alert
)
alert.addAction(UIAlertAction(title:"Update", style:.default){ _ inAppFresh.openAppStore()})
alert.addAction(UIAlertAction(title:"Cancel", style:.cancel, handler:nil))
// Assuming self is a view controller
self.present(alert, animated:true, completion:nil)}- iOS 13.0+
- tvOS 13.0+
- macOS 10.15+
- visionOS 1.0+