Code to check if there is a new version on AppStore.
This code is a version based on @anupgupta-arg's code.
You can force the update by calling
CheckUpdate.shared.showUpdate(withConfirmation: false)
Or the user can choose if they want to update now or later by calling
CheckUpdate.shared.showUpdate(withConfirmation: true)
Inside the code has a link from iTunes. There, you should pay attention and put the country where the application is available.
Like this: http://itunes.apple.com/<country>/lookup?bundleId=\(identifier)
For example:
let url = URL(string: "http://itunes.apple.com/br/lookup?bundleId=\(identifier)")
if the application is available in Brazil
- If you call this line
CheckUpdate.shared.showUpdate(withConfirmation: true)
- Or if you call this line
CheckUpdate.shared.showUpdate(withConfirmation: false)