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.
- ✅ Intuitive
SemanticVersiontype - ✍️ Initialisers for integers, strings, and string literals
- 🔐 Safe comparisons with automatic version normalisation
- 📦 Codable, Comparable, Hashable, Sendable
- 🧪 Fully testable and platform-agnostic
Add this package via Swift Package Manager:
.product(name:"Versioning",package:"versioning")You can construct a version using individual components:
letversion=SemanticVersion(major:2, minor:1, patch:4)Or string literals.
leta:SemanticVersion="1"letb:SemanticVersion="1.0"letc:SemanticVersion="1.0.0"
// normalised
assert(a == b)assert(b == c)assert(a == c)