Swiftpack.co - RougeWare/Swift-SemVer as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by RougeWare.
RougeWare/Swift-SemVer 3.0.0-Beta.5
A small Swift library that implements SemVer 2.0.0. This is designed to be simple to use and to easily fit into any Swift codebase.
⭐️ 3
🕓 35 weeks ago
linux macOS iOS
.package(url: "https://github.com/RougeWare/Swift-SemVer.git", from: "3.0.0-Beta.5")

Swift Semantic Versioning

A small library that implements SemVer 2.0.0. This is designed to be simple to use and to easily fit into any Swift codebase.

Examples

Let's say you have a release candidate of version 2.0 of your app. The following are all equivalent:

_ = SemVer(major: 2, minor: 0, preRelease: ["RC", 1])
_ = SemVer(2,0,0, preRelease: ["RC",1])
_ = SemVer("2.0-RC.1")
_ = SemVer("2.0.0-RC.1")

These can also be compared using Swift comparison operators. For instance, all these are true:

SemVer("2.0") == SemVer("2.0.0")
SemVer("1.2.0") < SemVer("2.0.0")
SemVer("1.2.0") <= SemVer("2.0.0")
SemVer("12.0") > SemVer("2.9.9")

Since this conforms to Semantic Version 2.0.0, attempting to use an invalid semantic version as a string will result in a nil object:

nil == SemVer("Obviously Bad")
nil == SemVer("1")
nil == SemVer("-2.0")
nil == SemVer("2.0-β")
nil == SemVer("2.0-beta_1")
nil == SemVer("1.-2")
nil == SemVer("1.2.-3")
nil == SemVer("1.2.3.4")

License

This is licensed under BH-1-PS Opus 2.

GitHub

link
Stars: 3
Last commit: 35 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Related Packages

Release Notes

3.0.0 β 5
37 weeks ago

This first beta addresses some issues regarding the concept of a semantic version:

Breaking changes

  • PATCH is now required (#5)
  • All non-build identifiers now reject leading zeroes (#14)
  • Removed support for Swift 4 (#17)
  • Enforced that a semantic version (excluding extensions) only increases normally (#25)

Other changes

  • Updated license to BH-1-PS Opus 3 (#4)
  • Completed documentation (#6)
  • Fixed problems with the comparison operator (#7; #24)
  • Now supports iOS, tvOS, & watchOS (#20)
  • Added Codable support (#27)
  • Added support for fuzzy equality (#29)

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