Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexanderwe/semanticversioningkit
Small library to create and parse Semantic Versioning conforming representations.
https://github.com/alexanderwe/semanticversioningkit
parser semantic-versioning swift swift-package-manager swift5
Last synced: 23 days ago
JSON representation
Small library to create and parse Semantic Versioning conforming representations.
- Host: GitHub
- URL: https://github.com/alexanderwe/semanticversioningkit
- Owner: alexanderwe
- License: mit
- Created: 2020-12-28T15:07:03.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-10-06T12:52:48.000Z (about 1 month ago)
- Last Synced: 2024-10-11T18:34:30.350Z (26 days ago)
- Topics: parser, semantic-versioning, swift, swift-package-manager, swift5
- Language: Swift
- Homepage: https://alexanderwe.github.io/SemanticVersioningKit/documentation/semanticversioningkit/
- Size: 844 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SemanticVersioningKit
SemanticVersioningKit is a small library to create and parse Semantic Versioning conforming representations.## Installation
### Swift Package Manager
To integrate using Apple's [Swift Package Manager](https://swift.org/package-manager/), add the following as a dependency to your `Package.swift`:
```swift
dependencies: [
.package(url: "https://github.com/alexanderwe/SemanticVersioningKit.git", from: "2.1.2")
]
```Alternatively navigate to your Xcode project, select `Swift Packages` and click the `+` icon to search for `SemanticVersioningKit`.
### Manually
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.
## Usage
At first import `SemanticVersioningKit`
```swift
import SemanticVersioningKit
```Define a `SemanticVersion` instance
```swift
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.
```swift
let version = try SemanticVersion(input: "1.0.0")
let failed = try SemanticVersion(input: ".0.0")
```## Contributing
Contributions are very welcome 🙌