Your app version tracker.
- App installed.
Versioner.currentVersion.isFreshInstall {
// Welcome user
}
- App updated.
Versioner.currentVersion.isUpdate { (prevVersion) in
// Show new features
}
- App downgraded
Versioner.currentVersion.isDowngrade { (prevVersion) in
// Disable app or prompt to update
}
- App build updated.
Versioner.currentVersion.isBuildUpdate { (prevVersion) in
// Notify tester
}
- App build downgraded.
Versioner.currentVersion.isBuildDowngrade { (prevVersion) in
// Clean app data directory or make core data model changes ... etc
}
- App launched with number X.
Versioner.currentVersion.isLaunch(number: 3) { (prevVersion) in
/*
Launch number X of this version (not all versions together),
X = any number you want */
}
Versioner.currentVersion.number // Marketing or iTunesConnect version
Versioner.currentVersion.build // Build number
Versioner.currentVersion.launchNumber // Number of app launches during this version
Versioner.currentVersion.firstLaunchDate // Date of first launch
Versioner.currentVersion.os_version // OS Version when this version first installed
Execute another specific code in future release
if Versioner.currentVersion > AppVersion("3.0") {
// Do new code
// ex: call new backend
} else {
// Do old code
// ex: call old backend
}
print(Versioner.currentVersion > AppVersion("3.0.0.1")) // true or false
print(AppVersion("3.0") < AppVersion("3.1")) // true
print(AppVersion("3.0") == AppVersion("3.0")) // true
Versioner is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "Versioner"
Then add this line to application didFinishLaunchingWithOptions
before calling any api method.
Versioner.initiate()
Husam Aamer , [email protected]
Made with ❤️ in 🇮🇶 under the MIT license.