Skip to content

Commit 28c2995

Browse files
committed
Modifying Version init to preserve old init
There are dependencies on the init being available with only the string argument
1 parent 2c8aa58 commit 28c2995

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Sources/TSCUtility/Version.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,21 @@ extension Version: CustomStringConvertible {
104104
}
105105

106106
public extension Version {
107+
108+
/// Create a version object from string.
109+
///
110+
/// - Parameters:
111+
/// - string: The string to parse.
112+
init?(string: String) {
113+
self.init(string: string, lenient: false)
114+
}
107115

108116
/// Create a version object from string.
109117
///
110118
/// - Parameters:
111119
/// - string: The string to parse.
112120
/// - lenient: Boolean indicating if partial strings should be parsed. Infers that strings without an explicit patch version have a patch version of zero. Defaults to false.
113-
init?(string: String, lenient: Bool = false) {
121+
init?(string: String, lenient: Bool) {
114122
let prereleaseStartIndex = string.firstIndex(of: "-")
115123
let metadataStartIndex = string.firstIndex(of: "+")
116124

0 commit comments

Comments
 (0)