Merge pull request #2 from RougeWare/feature/1-Swift-Package 1 Let’s strip it down and rebuild it as a Swift package
Merge pull request #2 from RougeWare/feature/1-Swift-Package
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.
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
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")
This is licensed under BH-1-PS Opus 2.
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
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:
These can also be compared using Swift comparison operators. For instance, all these are true:
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:License
This is licensed under BH-1-PS Opus 2.