VersionsTracker is a Swift Library, which tracks install version history of app and os version.

Overview

VersionsTracker

[CI Status](https://travis-ci.org/Martin Stemmle/VersionsTracker) Version License Platform

Keeping track of version installation history made easy.

Features

  • Track not just marketing version, but also build number and install date
  • Track both App and OS version
  • Access current version
  • Check for version updates and first launch
  • No use as Singleton required
  • Ability to use custom NSUserDefaults (e.g. for sharing it with extensions )

Example

To run the example project, clone the repo, and run pod install from the Example directory first. Play with the Sample app's version and build numbers.

Requirements

Installation

CocoaPods

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

pod "VersionsTracker"

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. Add the following line to your Cartfile:

github "martnst/VersionsTracker"

Usage

Initialization

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

    if iDontMindSingletons {
        VersionsTracker.initialize(trackAppVersion: true, trackOSVersion: true)
    }
    else {
        // make sure to update the version history once once during you app's life time
        VersionsTracker.updateVersionHistories(trackAppVersion: true, trackOSVersion: true)
    }

    return true
}

Get the current versions with build and install date

let versionsTracker = iDontMindSingletons ? VersionsTracker.sharedInstance : VersionsTracker()

let curAppVersion : Version = versionsTracker.appVersion.currentVersion
print("Current marketing version is \(curAppVersion.versionString) (Build \(curAppVersion.buildString)) and was first launched \(curAppVersion.installDate)")

Get the version history

let versionsTracker = iDontMindSingletons ? VersionsTracker.sharedInstance : VersionsTracker()

let appVersions: [Version] = versionsTracker.appVersion.versionHistory
let firstOSVerion : Version = versionsTracker.osVersion.versionHistory.first!
print("The very first time the app was launched on iOS \(firstOSVerion.versionString) on \(firstOSVerion.installDate)")

Check version changes easily

let versionsTracker = iDontMindSingletons ? VersionsTracker.sharedInstance : VersionsTracker()

switch versionsTracker.appVersion.changeState {
case .installed:
    // πŸŽ‰ Sweet, a new user just installed your app
    // ... start tutorial / intro
    print("πŸ†• Congratulations, the app is launched for the very first time")

case .notChanged:
    // 😴 nothing as changed
    // ... nothing to do
    print("πŸ”„ Welcome back, nothing as changed since the last time")

case .updated(let previousVersion: Version):
    // πŸ™ƒ new build of the same version
    // ... hopefully it fixed those bugs the QA guy reported
    print("πŸ†™ The app was updated making small changes: \(previousVersion) -> \(versionTracker.currentVersion)")

case .upgraded(let previousVersion):
    // πŸ˜„ marketing version increased
    // ... migrate old app data
    print("⬆️ Cool, its a new version: \(previousVersion) -> \(versionTracker.currentVersion)")

case .downgraded(let previousVersion):
    // 😡 marketing version decreased (hopefully we are not on production)
    // ... purge app data and start over
    print("⬇️ Oohu, looks like something is wrong with the current version to make you come back here: \(previousVersion) -> \(versionTracker.currentVersion)")
}    

Since the build is also kept track off, it enables detecting updates of it as well. However, the build fraction of a version is treated as an arbitrary string. This is to support any build number, from integer counts to git commit hashes. Therefor there is no way to determine the direction of a build change.

Compare Version

let versionsTracker = iDontMindSingletons ? VersionsTracker.sharedInstance : VersionsTracker()
let curAppVersion : Version = versionsTracker.appVersion.currentVersion

curAppVersion >= Version("1.2.3")
curAppVersion >= "1.2.3"
Version("1.2.3") < Version("3.2.1")
curAppVersion != Version("1.2.3", buildString: "B19")

Versions with the same marketing version but different build are not equal.

Author

Martin Stemmle, [email protected]

License

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

You might also like...
Custom UIView class that hosts an array of UIbuttons that have an 'underline' UIView beneath them which moves from button to button when the user presses on them.
Custom UIView class that hosts an array of UIbuttons that have an 'underline' UIView beneath them which moves from button to button when the user presses on them.

Swift-Underlined-Button-Bar Custom UIView class that hosts an array of UIbuttons that have an 'underline' UIView beneath them which moves from button

βœ‚ Easy to use and flexible library for manually laying out views and layers for iOS and tvOS. Supports AsyncDisplayKit.

ManualLayout Table of Contents Installation Usage API Cheat Sheet Installation Carthage Add the following line to your Cartfile. github "isair/ManualL

Library that makes it easy to create multiple environments within a single app. You can switch environments without deleting the application.

AppContainer Library that makes it easy to create multiple environments within a single app. You can switch environments without deleting the applicat

CompositionalLayoutDSL, library to simplify the creation of UICollectionViewCompositionalLayout. It wraps the UIKit API and makes the code shorter and easier to read.
CompositionalLayoutDSL, library to simplify the creation of UICollectionViewCompositionalLayout. It wraps the UIKit API and makes the code shorter and easier to read.

CompositionalLayoutDSL CompositionalLayoutDSL is a Swift library. It makes easier to create compositional layout for collection view. Requirements Doc

 BrickKit is a delightful layout library for iOS and tvOS. It is written entirely in Swift!
BrickKit is a delightful layout library for iOS and tvOS. It is written entirely in Swift!

BrickKit is a delightful layout library for iOS and tvOS. It is written entirely in Swift! Deprecated BrickKit is being phased out at Wayfair, and the

VidyoPlatform Basic CustomLayouts Reference App for iOS (Swift)VidyoPlatform Basic CustomLayouts Reference App for iOS (Swift)

VidyoPlatform Basic CustomLayouts Reference App for iOS (Swift) VidyoPlatform reference application highlighting how to integrate video chat into a na

LayoutKit is a fast view layout library for iOS, macOS, and tvOS.
LayoutKit is a fast view layout library for iOS, macOS, and tvOS.

🚨 UNMAINTAINED 🚨 This project is no longer used by LinkedIn and is currently unmaintained. LayoutKit is a fast view layout library for iOS, macOS, a

Intuitive and powerful Auto Layout library
Intuitive and powerful Auto Layout library

Align introduces a better alternative to Auto Layout anchors. Semantic. Align APIs focus on your goals, not the math behind Auto Layout constraints. P

LayoutKit is a fast view layout library for iOS, macOS, and tvOS.
LayoutKit is a fast view layout library for iOS, macOS, and tvOS.

🚨 UNMAINTAINED 🚨 This project is no longer used by LinkedIn and is currently unmaintained. LayoutKit is a fast view layout library for iOS, macOS, a

Comments
Releases(0.3.0)
Owner
Martin Stemmle
Martin Stemmle
Fancy Swift implementation of the Visual Format Language (experimental and doesn't work with the recent version of Swift)

VFLToolbox Autolayout is awesome! VFL a.k.a Visual Format Language is even more awesome because it allows you to shorten constraints setting code. The

0xc010d 144 Jun 29, 2022
An easy way to create and layout UI components for iOS (Swift version).

Introduction Cupcake is a framework that allow you to easily create and layout UI components for iOS 8.0+. It use chaining syntax and provides some fr

nerdycat 288 Oct 9, 2022
A simple integrated version of iOS 13 Compositional Layout, modified into a way similar to Functional Programming to generate UICollectionViewCompositionalLayout.

WWCompositionalLayout A simple integrated version of iOS 13 Compositional Layout, modified into a way similar to Functional Programming to generate UI

William-Weng 1 Jul 4, 2022
Semi-automatic installation of mods for the iOS version of KOTOR 1

KOTOR 1 Mod Manager Welcome to KOTOR 1 Mod Manager (K1MM for short), a tool designed to allow easy and simple installation of mods for the iOS version

Lilly 3 Jul 11, 2022
Breezz: an application with which it is easy and simple to practice breathing exercises and meditation

breezz will help you relax Breezz is an application with which it is easy and si

dumojo 1 Jan 18, 2022
A tech-for-good, green and digital solution based on CSA which promotes the green agricultural production for small farmers, provides responsible produce for consumers.

Green Farm IBM : Call for Code 2021 Green Farm is a tech-for-good, green and digital solution based on CSA which promotes the green agricultural produ

null 0 Oct 14, 2022
A SwiftUI proof-of-concept, and some sleight-of-hand, which adds rain to a view's background

Atmos A SwiftUI proof-of-concept, and some sleight-of-hand, which adds rain to a view's background. "Ima use this in my app..." Introducing Metal to S

Nate de Jager 208 Jan 2, 2023
An flexbox layout aimed at easy to use, which depend on Yoga.

DDFlexbox A flexbox framework for easy using. Install pod 'DDFlexbox' Template install Recommend using templates to create flexbox views. cd Script/

Daniel 12 Mar 23, 2022
UIView category which makes it easy to create layout constraints in code

FLKAutoLayout FLKAutoLayout is a collection of categories on UIView which makes it easy to setup layout constraints in code. FLKAutoLayout creates sim

Florian Kugler 1.5k Nov 24, 2022
Yoga is a cross-platform layout engine which implements Flexbox.

Yoga Building Yoga builds with buck. Make sure you install buck before contributing to Yoga. Yoga's main implementation is in C++, with bindings to su

Meta 15.8k Jan 9, 2023