Version
A version according to the semantic versioning specification.
Version.swift:38struct Version
A package version consists of three integers separated by periods, for example 1.0.0
. It must conform to the semantic versioning standard in order to ensure that your package behaves in a predictable manner once developers update their package dependency to a newer version. To achieve predictability, the semantic versioning specification proposes a set of rules and requirements that dictate how version numbers are assigned and incremented. To learn more about the semantic versioning specification, visit Semantic Versioning 2.0.0.
- The major version
The first digit of a version, or major version, signifies breaking changes to the API that require updates to existing clients. For example, the semantic versioning specification considers renaming an existing type, removing a method, or changing a method’s signature breaking changes. This also includes any backward-incompatible bug fixes or behavioral changes of the existing API.
- The minor version
Update the second digit of a version, or minor version, if you add functionality in a backward-compatible manner. For example, the semantic versioning specification considers adding a new method or type without changing any other API to be backward-compatible.
- The patch version
Increase the third digit of a version, or patch version, if you’re making a backward-compatible bug fix. This allows clients to benefit from bugfixes to your package without incurring any maintenance burden.
See also
let kind: Package.Dependency.Kind
A description of the package dependency.
Citizens in PackageDescription
Conformances
protocol Comparable
A type that can be compared using the relational operators
<
,<=
,>=
, and>
.protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol ExpressibleByExtendedGraphemeClusterLiteral
A type that can be initialized with a string literal containing a single extended grapheme cluster.
protocol ExpressibleByStringLiteral
A type that can be initialized with a string literal.
protocol ExpressibleByUnicodeScalarLiteral
A type that can be initialized with a string literal containing a single Unicode scalar value.
protocol LosslessStringConvertible
A type that can be represented as a string in a lossless, unambiguous way.
Type members
init?(String
) Initializes a version struct with the provided version string.
init(Int, Int, Int, prereleaseIdentifiers: [String], buildMetadataIdentifiers: [String]
) Initializes a version struct with the provided components of a semantic version.
init(extendedGraphemeClusterLiteral: String
) Initializes a version struct with the provided extended grapheme cluster.
init(stringLiteral: String
) Initializes a version struct with the provided string literal.
init(unicodeScalarLiteral: String
) Initializes a version struct with the provided Unicode string.
static func < (lhs: Version, rhs: Version
) -> Bool Returns a Boolean value indicating whether the value of the first argument is less than that of the second argument.
static func == (lhs: Version, rhs: Version
) -> Bool Returns a Boolean value indicating whether two values are equal.
Instance members
let buildMetadataIdentifiers: [String]
The build metadata of this version according to the semantic versioning standard, such as a commit hash.
var description: String
A textual description of the version object.
let major: Int
The major version according to the semantic versioning standard.
let minor: Int
The minor version according to the semantic versioning standard.
let patch: Int
The patch version according to the semantic versioning standard.
let prereleaseIdentifiers: [String]
The pre-release identifier according to the semantic versioning standard, such as
-beta.1
.
Type features
init(extendedGraphemeClusterLiteral: Self.StringLiteralType
) init(unicodeScalarLiteral: Self.ExtendedGraphemeClusterLiteralType
) static func != (lhs: Self, rhs: Self
) -> Bool Returns a Boolean value indicating whether two values are not equal.
static func ... (minimum: Self
) -> PartialRangeFrom<Self> Returns a partial range extending upward from a lower bound.
static func ... (maximum: Self
) -> PartialRangeThrough<Self> Returns a partial range up to, and including, its upper bound.
static func ... (minimum: Self, maximum: Self
) -> ClosedRange<Self> Returns a closed range that contains both of its bounds.
static func ..< (maximum: Self
) -> PartialRangeUpTo<Self> Returns a partial range up to, but not including, its upper bound.
static func ..< (minimum: Self, maximum: Self
) -> Range<Self> Returns a half-open range that contains its lower bound but not its upper bound.
static func <= (lhs: Self, rhs: Self
) -> Bool Returns a Boolean value indicating whether the value of the first argument is less than or equal to that of the second argument.
static func > (lhs: Self, rhs: Self
) -> Bool Returns a Boolean value indicating whether the value of the first argument is greater than that of the second argument.
static func >= (lhs: Self, rhs: Self
) -> Bool Returns a Boolean value indicating whether the value of the first argument is greater than or equal to that of the second argument.