Skip to content

JohnEstropia/AppVersionMonitor

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AppVersionMonitor

CI Status Version License Platform

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

AppVersionMonitor is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "AppVersionMonitor"

Usage

Setup

// AppDelegate

func applicationDidFinishLaunching(application: UIApplication) {

    AppVersionMonitor.sharedMonitor.startup()
}

Get MarketingVersion (CFBundleShortVersionString)

let currentVersion: AppVersion = AppVersion.marketingVersion
let versionString: String = AppVersion.marketingVersion.versionString // "1.2.3"

Get installed version

let installedVersions: [AppVersion] = AppVersionMonitor.sharedMonitor.installedVersions

Compare Version

AppVersion.marketingVersion > AppVersion("1.2.3")
AppVersion("1.2.3") < AppVersion("3.2.1")
AppVersion("1.2.3") < "3.2.1"

You can check app version status easily.

switch AppVersionMonitor.sharedMonitor.state {
case .Installed:

// Do something when app installed.
// Happy! 🍻
// ex. Start tutorial.

case .NotChanged:

// Do something when version not changed.
// Peace 😌
// Nothing to do?

case .Upgraded(let previousVersion: AppVersion):

// Do something when version upgraded.
// Yeah! 😝
// ex. Migrate App Data.

case .Downgraded(let previousVersion: AppVersion):

// Do something when version downgraded. (Impossible normally)
// What happened? 😵
// ex. Purge App Data.

}

Author

muukii m@muukii.me

License

AppVersionMonitor is available under the MIT license. See the LICENSE file for more info.

About

Monitor iOS app version easily.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 48.9%
  • Shell 39.8%
  • Ruby 8.2%
  • Objective-C 3.1%