Skip to content

STRUCT

PackageVersion ​

Contents

  • Properties
    • maxSegmentCount
    • major
    • minor
    • patch
    • segment4
    • segment5
    • preReleaseSegments
    • preRelease
    • buildMetadata
    • value
    • description
    • versionCharset
    • lowest
  • Methods
    • init(from:)
    • parse(from:)
    • init(_:_:_:_:_:preRelease:buildMetadata:preReleaseSegments:value:)
    • bump()
    • bumpMinor()
    • bumpMajor()
    • ==(_:_:)
    • hash(into:)
    • <(_:_:)
swift
public struct PackageVersion: CustomStringConvertible, Codable, Comparable, Equatable, Hashable

Properties ​

maxSegmentCount ​

swift
public static let maxSegmentCount = 5

major ​

swift
public let major: Int

minor ​

swift
public let minor: Int

patch ​

swift
public let patch: Int

segment4 ​

swift
public let segment4: Int

segment5 ​

swift
public let segment5: Int

preReleaseSegments ​

swift
public let preReleaseSegments: [String]

preRelease ​

swift
public let preRelease: String?

buildMetadata ​

swift
public let buildMetadata: String?

value ​

swift
public let value: String

description ​

swift
public var description: String

versionCharset ​

swift
public static let versionCharset: CharacterSet = {
    var charset = CharacterSet.decimalDigits
    charset.insert(charactersIn: ".-+")
    charset.insert(charactersIn: "a"..."z")
    charset.insert(charactersIn: "A"..."Z")
    return charset
}()

lowest ​

swift
public static let lowest: PackageVersion = .init(0, 0, 0, 0, 1)

Methods ​

init(from:) ​

swift
public init(from str: CustomStringConvertible)

parse(from:) ​

swift
public static func parse(from str: CustomStringConvertible) -> PackageVersion?

init(_:_:_:_:_:preRelease:buildMetadata:preReleaseSegments:value:) ​

swift
public init(
    _ major: Int,
    _ minor: Int = 0,
    _ patch: Int = 0,
    _ segment4: Int = 0,
    _ segment5: Int = 0,
    preRelease: String? = nil,
    buildMetadata: String? = nil,
    preReleaseSegments: [String] = [],
    value: String? = nil
)

bump() ​

swift
public func bump() -> Self

bumpMinor() ​

swift
public func bumpMinor() -> Self

bumpMajor() ​

swift
public func bumpMajor() -> Self

==(_:_:) ​

swift
public static func == (lhs: Self, rhs: Self) -> Bool

Parameters ​

NameDescription
lhsA value to compare.
rhsAnother value to compare.

hash(into:) ​

swift
public func hash(into hasher: inout Hasher)

Parameters ​

NameDescription
hasherThe hasher to use when combining the components of this instance.

<(_:_:) ​

swift
public static func < (lhs: Self, rhs: Self) -> Bool

Parameters ​

NameDescription
lhsA value to compare.
rhsAnother value to compare.