Swift Package Manager
To integrate using Apple's Swift Package Manager, add the following as a dependency to your
dependencies: [ .package(url: "https://github.com/alexanderwe/SemanticVersioningKit.git", from: "1.0.0") ]
Alternatively navigate to your Xcode project, select
Swift Packages and click the
+ icon to search for
If you prefer not to use any of the aforementioned dependency managers, you can integrate
SemanticVersioningKit into your project manually. Simply drag the
Sources Folder into your Xcode project.
At first import
let version = SemanticVersion(major: 1, minor: 0, patch: 0) // "1.0.0" let versionWithAdditions = SemanticVersion(major: 1, minor: 0, patch: 0, preReleaseIdentifiers: ["alpha", "1"], buildIdentifiers: ["exp","sha","5114f85"]) // "1.0.0-alpha.1+exp.sha.5114f85"
It is also possible to create a
SemanticVersion from a
String representation. Just be aware that the initialization can fail due to the used
String not conforming to the Semantic Versioning format. Therefore an optional
SemanticVersion is returned in those cases.
let version = SemanticVersion("1.0.0") let failed = SemanticVersion(".0.0")
Contributions are very welcome 🙌