Skip to content

Commit 634fd42

Browse files
authored
Merge pull request #6 from tuist/add-xcode-value
Add `Version.xcodeStringValue` getter to get the value to use in Xcode projects.
2 parents bef77e5 + dd009aa commit 634fd42

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

Sources/XcodeGraph/Models/Version.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ public struct Version: Hashable, Codable, Sendable {
3434
self.prereleaseIdentifiers = prereleaseIdentifiers
3535
self.buildMetadataIdentifiers = buildMetadataIdentifiers
3636
}
37+
38+
/// Returns the value that Xcode projects use internally.
39+
public var xcodeStringValue: String {
40+
"\(major)\(minor)\(patch)"
41+
}
3742
}
3843

3944
extension Version: Comparable {
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import Foundation
2+
import XcodeGraph
3+
import XCTest
4+
5+
final class VersionTests: XCTestCase {
6+
func test_xcodeStringValue() {
7+
// Given
8+
let version = Version(stringLiteral: "1.2.3")
9+
10+
// When
11+
let got = version.xcodeStringValue
12+
13+
// Then
14+
XCTAssertEqual(got, "123")
15+
}
16+
}

0 commit comments

Comments
 (0)