SemVer

2.0.0

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.
RougeWare/Swift-SemVer

What's New

2.0.0 - Swift 5.1 Package

2019-09-21T01:32:59Z

Finally, a real release! SemVer is now ready for Swift Package Manager

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.

Description

  • Swift Tools 5.1.0
View More Packages from this Author

Dependencies

  • None
Last updated: Sun Oct 20 2024 16:03:17 GMT-0900 (Hawaii-Aleutian Daylight Time)