Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Latest commit

 

History

History
103 lines (85 loc) · 2.75 KB

README.md

File metadata and controls

103 lines (85 loc) · 2.75 KB

Language Swift 3 & 4 CI Status Version License Platform

Versioner

Your app version tracker.

Usages

#1 : Events

  • 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 */

}

#2 : CurrentVersion info

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

#3 : Operators and Version check

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

Installation

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()

Author

Husam Aamer , [email protected]

License

Made with ❤️ in 🇮🇶 under the MIT license.