Skip to content

Code to check if there is a new version on the App Store.

License

Notifications You must be signed in to change notification settings

jaywcjlove/swift-check-update

Repository files navigation

CheckUpdate

Buy me a coffee SwiftUI Support

Code to check if there is a new version on the App Store, to determine whether an update prompt needs to be shown.

Tip

After the app is released, it will not update immediately on the App Store; it needs to wait 24 hours before it works properly.

✦ My macOS/iOS application ✦

KeyClicker DayBar Iconed RightMenu Master Quick RSS Quick RSS Web Serve Copybook Generator DevTutor for SwiftUI RegexMate Time Passage Iconize Folder Textsound Saver Create Custom Symbols DevHub Resume Revise Palette Genius Symbol Scribe

Usage

import CheckUpdate

CheckUpdate.checkVersion { isUpdateNeeded, appStoreVersion, currentVersion in
    // Here it checks whether an update prompt needs to be shown.
}

CheckUpdate.checkVersion(bundleId: "com.wangchujiang.daybar") {
    isUpdateNeeded,
    appStoreVersion,
    currentVersion in

    // appStoreVersion -> "1.0"
    // currentVersion -> "2.0"
    // isUpdateNeeded -> false
}

CheckUpdate.checkVersion(bundleId: "com.wangchujiang.daybar") {
    isUpdateNeeded,
    appStoreVersion,
    currentVersion in

    // appStoreVersion -> "2.0"
    // currentVersion -> "1.0"
    // isUpdateNeeded -> true
}

License

Licensed under the MIT License.