Swiftpack.co - Package - hkellaway/AppVersion

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.

Github

link
Stars: 0

Dependencies

Used By

Total: 0

Releases

0.2.0 - 2020-09-23 03:13:20

See CHANGELOG

- 2020-09-09 04:47:17

See CHANGELOG