Home > Enterprise >  Compare app versions after update using decimals like 2.5.2
Compare app versions after update using decimals like 2.5.2

Time:02-03

Sometimes cache cleanup is needed after a big update, so I'd like to check once the user updates the app if the app version is above or below the one that needs cache cleanup.

For example, I currently have this to check when it's a new app update or install:

import BundleInfoVersioning

func displayUpdateNotification() {
    let bundleInfoVersioning = BundleInfoVersioning(bundle: .main)
    
    bundleInfoVersioning.check(forKeyPath: "CFBundleShortVersionString") { (old: String? , newVersion: String?) in
        if old == nil {
            // You can place some analytics here ...
            print("           
  •  Tags:  
  • Related