Skip to content

nashysolutions/versioning

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Versioning

Versioning is a lightweight, modern Swift library for working with semantic versioning.
It provides a simple and expressive API for defining, comparing, and validating version numbers.


Features

  • ✅ Intuitive SemanticVersion type
  • ✍️ Initialisers for integers, strings, and string literals
  • 🔐 Safe comparisons with automatic version normalisation
  • 📦 Codable, Comparable, Hashable, Sendable
  • 🧪 Fully testable and platform-agnostic

📦 Installation

Add this package via Swift Package Manager:

.product(name: "Versioning", package: "versioning")

Usage

You can construct a version using individual components:

let version = SemanticVersion(major: 2, minor: 1, patch: 4)

Or string literals.

let a: SemanticVersion = "1"
let b: SemanticVersion = "1.0"
let c: SemanticVersion = "1.0.0"

// normalised
assert(a == b)
assert(b == c)
assert(a == c)