---
title: "SemanticVersion, DroppyKit"
description: "A three-component semantic version, compared numerically."
canonical: "https://getdroppy.app/docs/droppykit/api/semantic-version"
last-updated: "2026-09-09"
---

# SemanticVersion

A three-component semantic version, compared numerically.

`struct SemanticVersion`

The string initializer also accepts `X` and `X.Y` as shorthand and fills missing components with zero. Droplet release manifests require the full `X.Y.Z` form; requirement fields can use the shorthand where documented.

## Initializers

### init(_:_:_:)

`init(_ major: Int, _ minor: Int, _ patch: Int)`

Creates a version from components.

### init(from:)

`init(from decoder: Decoder) throws`

### init(string:)

`init?(string: String)`

Parses `X`, `X.Y`, or `X.Y.Z` with bounded ASCII decimal components. Returns `nil` for anything else. Droplet release manifests apply their stricter `X.Y.Z` rule before constructing this value.

## Properties

### description

`var description: String { get }`

### major

`let major: Int`

Major component.

### minor

`let minor: Int`

Minor component.

### patch

`let patch: Int`

Patch component.

## Methods

### encode(to:)

`func encode(to encoder: Encoder) throws`

## Operators

### <(_:_:)

`static func < (lhs: SemanticVersion, rhs: SemanticVersion) -> Bool`
