Swiftpack.co - mflknr/SwiftVersionCompare as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
mflknr/SwiftVersionCompare 1.1.0
Create and compare semantic versions in swift.
⭐️ 3
🕓 3 weeks ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/mflknr/SwiftVersionCompare.git", from: "1.1.0")

SwiftVersionCompare

platforms swiftcomp build codecov doccov licence Twitter

A package introducing a Version object implementing the SemanticVersionComparable protocol for comparing versions conforming to SemVer.

Installation

Swift Package Manager:

package(url: https://github.com/mflknr/SwiftVersionCompare.git", from: "1.1.0"))

CocoaPods

pod 'SwiftVersionCompare', '~> 1.1.0'

Usage

For detailed implementation information see documentation.

// use the version core identifier for initialization
let versionOne = Version(1, 0, 0)
let versionTwo = Version(
    major: 1,
    minor: 0,
    patch: 0,
    prerelease: [.alpha],
    build: ["1"]
) // -> prints: "1.0.0-alpha+1"

// use strings
// use `ExpressibleByStringLiteral` with caution, because it's fatal if string is not `SemVer` version
let versionThreeA: Version? = "1.0.0" 
let versionThreeB: Version? = Version("1.0.0")

// easy initial `0.0.0` version
let initialVersion: Version = .initial

// from bundle and processInfo
let bundleVersion = Bundle.main.shortVersion
let osVersion = ProcessInfo.processInfo.comparableOperatingSystemVersion

// compare versions with usally known operators (==, ===, <, <=, >=, >)
if Version("1.0.0") > Version("0.4.0") {
    // ...
}

GitHub

link
Stars: 3
Last commit: 3 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Release Notes

[1.1.0] - 2021-10-02
3 weeks ago

Added

Changed

  • Updated documentation for more clarity.

Chores

  • cleanup podspec and make readme release rdy (mflknr)
  • remove 5.5 from CI since its not available yet (mflknr)
  • update changelog (mflknr)

Commits

  • 83e1a57: Update Documentation (#13) (Marius Felkner) #13
  • 12a22fe: Add cocoapods support (#14) (Marius Felkner) #14

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics