@@ -22,74 +22,6 @@ import Foundation
22
22
/// 2. MINOR version when you add functionality in a backwards compatible manner, and
23
23
/// PATCH version when you make backwards compatible bug fixes.
24
24
/// Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.
25
- ///
26
- /// Once instantiated, you can query a `SemanticVersion` about its components:
27
- ///
28
- /// ```swift
29
- /// let v123 = SemanticVersion(1, 2, 3)
30
- /// v123.isStable // true
31
- /// v123.isPreRelease // false
32
- /// v123.isMajorRelease // false
33
- /// v123.isMinorRelease // false
34
- /// v123.isPatchRelease // true
35
- /// ```
36
- ///
37
- /// You can also instantiate a `SemanticVersion` from a string
38
- ///
39
- /// ```swift
40
- /// let v200 = SemanticVersion("2.0.0")!
41
- /// v200.isStable // true
42
- /// v200.isPreRelease // false
43
- /// v200.isMajorRelease // true
44
- /// v200.isMinorRelease // false
45
- /// v200.isPatchRelease // false
46
- /// ```
47
- ///
48
- /// `SemanticVersion` supports beta versions:
49
- ///
50
- /// ```swift
51
- /// let v300rc1 = SemanticVersion("3.0.0-rc1-test")!
52
- /// v300rc1.isStable // false
53
- /// v300rc1.isPreRelease // true
54
- /// v300rc1.isMajorRelease // false
55
- /// v300rc1.isMinorRelease // false
56
- /// v300rc1.isPatchRelease // false
57
- /// v300rc1.major // 3
58
- /// v300rc1.minor // 0
59
- /// v300rc1.patch // 0
60
- /// v300rc1.preRelease // "rc1-test"
61
- /// ```
62
- ///
63
- /// `SemanticVersion` is `Comparable` and `Equatable`:
64
- ///
65
- /// ```swift
66
- /// v123 < v200 // true
67
- /// SemanticVersion("2.0.0")! < SemanticVersion("2.0.1")! // true
68
- /// // NB: beta versions come before their releases
69
- /// SemanticVersion("2.0.0")! > SemanticVersion("2.0.0-b1")! // true
70
- /// v123 == SemanticVersion("1.2.3") // true
71
- /// SemanticVersion("v1.2.3-beta1+build5")
72
- /// == SemanticVersion(1, 2, 3, "beta1", "build5") // true
73
- /// ```
74
- ///
75
- /// `SemanticVersion` is `Hashable`:
76
- ///
77
- /// ```swift
78
- /// let dict = [ // [{major 3, minor 0, patch 0,...
79
- /// v123: 1,
80
- /// v200: 2,
81
- /// v300rc1: 3
82
- /// ]
83
- /// ```
84
- ///
85
- /// `SemanticVersion` is `Codable`:
86
- ///
87
- /// ```swift
88
- /// let data = try JSONEncoder().encode(v123) // 58 bytes
89
- /// let decoded = try JSONDecoder().decode(SemanticVersion.self, from: data) // 1.2.3
90
- /// decoded == v123 // true
91
- /// ```
92
-
93
25
public struct SemanticVersion : Codable , Equatable , Hashable {
94
26
public var major : Int
95
27
public var minor : Int
0 commit comments