Version
public struct Version : Equatable, Hashable, Codable
extension Version: Comparable
extension Version: CustomStringConvertible
Represents a generic version with major and minor fields.
Warning
Maximum supported version is: 65535.65535.18446744073709551615.18446744073709551615Warning
Equality is done without build number, if build number checking is needed, please useisEqualWithBuild(_:)
and isLowerThanWithBuild(_:)
.
-
The major field of the version, such as 1 in version 1.5.3.4.
Declaration
Swift
public let major: UInt16
-
The minor field of the version, such as 5 in version 1.5.3.4.
Declaration
Swift
public let minor: UInt16
-
The patch field of the version, such as 3 in version 1.5.3.4.
Declaration
Swift
public let patch: UInt64?
-
The build number field of the version, such as 4 in version 1.5.3.4.
Declaration
Swift
public let buildNumber: UInt64?
-
Creates a new version with the provided values.
Declaration
Swift
public init(major: UInt16, minor: UInt16, patch: UInt64? = 0, buildNumber: UInt64? = 0)
Parameters
major
The major field of the version.
minor
The minor field of the version.
patch
The patch field of the version.
buildNumber
The build number field of the version.
-
Declaration
Swift
public static func < (lhs: Version, rhs: Version) -> Bool
-
Declaration
Swift
public static func == (lhs: Version, rhs: Version) -> Bool
-
Creates a new Version object from a string representation, e.g. ‘1.5.3.4’.
Declaration
Swift
public init(value: String)
Parameters
value
A string representation of the version.
Return Value
A new version object that represents the given string value.
-
Declaration
Swift
public var description: String { get }
-
Version 1.0
Declaration
Swift
static let version1_0: Version
-
Version 1.1
Declaration
Swift
static let version1_1: Version
-
Version 2.0
Declaration
Swift
static let version2_0: Version