Skip to content

Latest commit

 

History

History
77 lines (50 loc) · 2.27 KB

README.md

File metadata and controls

77 lines (50 loc) · 2.27 KB

AppVersion

Swift version SPM Compatible CocoaPods compatible License Build Status

A Swift μ-Library for determining app version

Basic Usage

AppVersion is a simple little library that offers a structured type around typical app versioning. It currently supports the format of major.minor.patch, a subspecies of Semver.

Retrieving from Bundle

let currentAppVersion: AppVersion? = .fromBundle

Creation from String

An AppVersion can conveniently be created from a String:

let appVersion: AppVersion = "1.2.3"

Comparison

Comparison operations (==, >, <, etc.) work seamlessly:

let minimumAppVersion: AppVersion = "2.0.0"
guard let currentAppVersion: AppVersion = .fromBundle, currentAppVersion >= minimumAppVersion else {
  // send user to App Store
}

SemVer Utility

Determining Stability

To determine whether the version is stable / has a public API:

appVersion.isStable

Next Version

To detemrine the next version:

appVersion.nextMajor() // i.e. 1.2.3 goes to 2.0.0
appVersion.nextMinor() // i.e. 1.2.3 goes to 1.3.0
appVersion.nextPatch() // i.e. 1.2.3 goes to 1.2.4

Installation

Swift Package Manager

See Adding Package Dependencies to Your App. Point to the desired version or the trunk branch.

CocoaPods

pod 'AppVersion', :git => 'https://github.com/hkellaway/AppVersion.git', :branch => 'trunk'

Credits

AppVersion was created by Harlan Kellaway.

License

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