Skip to content

davidrothera/SUPSemVer

Repository files navigation

Platform iOS 8+ Platform Mac OS X 10.9+ Platform Platform
Language Swift 3 Carthage compatible Build Status codecov.io Version License Platform

SUPSemVer

Easy to use framework for comparing semantic versions.

As per the spec for Semantic Versioning versions should be formatted as:

MAJOR.MINOR.PATCH (e.g. 1.0.1)
-or-
MAJOR.MINOR.PATCH-PRERELEASE (e.g. 1.0.1-rc1)

When you have these versions it is hard to compare them to see whether one version is newer than another etc.

Usage

There are a couple of ways that you can use SUPSemVer:

import SUPSemVer

let test1 = SemVer("1.0.1")
let test2 = SemVer("1.0.2-rc1")
let test3 = SemVer(major: 1, minor: 0, patch: 3)
let test4 = SemVer(major: 1, minor: 0, patch: 4, prerelease: "rc1")
let test5 = SemVer(major: 1, minor: 0, patch: 1)

The class implements the Equatable protocol meaning that you can compare one SemVer object to another

test3 > test1   # false
test1 == test5  # true

Installation

SUPSemVer version 1.0.4 required Swift3 which is not backwards compatible with Swift2, if you require Swift2 support please use version 1.0.3

CocoaPods

pod 'SUPSemVer'

Carthage

github "davidrothera/SUPSemVer"

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published