Latest 0.2.1
Homepage https://github.com/dcordero/Version
License MIT
Platforms ios 8.0
Authors

License: MIT Build Status

A simpler way to manage Versions in Swift

Initialization

Using the default separator (which is a single point)

let myVersion = Version("1.5.2")

Or using a different separator

let myVersion = Version("1-5-1", usingSeparator: "-")

Logic Operator

Version supports the ==, >, <, <=, and >= operators

Example

let myVersion1 = Version("1-5-2", usingSeparator: "-")
let myVersion2 = Version("1.5.2.1")

print(myVersion1 == myVersion2) // "false"
print(myVersion1 > myVersion2)  // "false"
print(myVersion1 >= myVersion2) // "false"
print(myVersion1 < myVersion2)  // "true"
print(myVersion1 <= myVersion2) // "true"

Installation

Cocoapods

To integrate SwiftyVersion into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!

target '<Your Target Name>' do
    pod 'SwiftyVersion', '~> 0.2.1'
end

Latest podspec

{
    "name": "SwiftyVersion",
    "version": "0.2.1",
    "license": "MIT",
    "summary": "A simple object to manage Versions in Swift.",
    "homepage": "https://github.com/dcordero/Version",
    "social_media_url": "https://twitter.com/dcordero",
    "authors": {
        "David Cordero": "[email protected]rez.es"
    },
    "source": {
        "git": "https://github.com/dcordero/SwiftyVersion.git",
        "tag": "0.2.1"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "Sources/Version.swift",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This