Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/noppefoxwolf/semanticversioning
https://github.com/noppefoxwolf/semanticversioning
Last synced: 29 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/noppefoxwolf/semanticversioning
- Owner: noppefoxwolf
- Created: 2023-07-31T13:17:08.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-24T06:06:27.000Z (11 months ago)
- Last Synced: 2024-05-02T05:46:11.692Z (6 months ago)
- Language: Swift
- Size: 8.79 KB
- Stars: 11
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SemanticVersioning
![GitHub Actions](https://github.com/noppefoxwolf/SemanticVersioning/actions/workflows/swift.yml/badge.svg)
## Codable
```swift
let json = ##"{"semanticVersion":"1.2.0-alpha.11+feddcc"}"##
struct Version: Codable {
let semanticVersion: SemanticVersion
}
let jsonDecoder = JSONDecoder()
let decoded = try jsonDecoder.decode(Version.self, from: Data(json.utf8))decoded.semanticVersion.major // 1
decoded.semanticVersion.minor // 2
decoded.semanticVersion.patch // 0
decoded.semanticVersion.preRelease // alpha, 11
decoded.semanticVersion.build // feddcc
```## Comparable
```swift
let semanticVersionA = SemanticVersion(...) // 1.0.0-beta.11
let semanticVersionB = SemanticVersion(...) // 1.0.0-rc.1
semanticVersionA < semanticVersionB
```# Apps Using
# License
SemanticVersioning is available under the MIT license. See the LICENSE file for more info.