File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Sources/SwiftDriver/Toolchains Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -240,7 +240,7 @@ public final class DarwinToolchain: Toolchain {
240
240
case canonicalName = " CanonicalName "
241
241
}
242
242
243
- public enum SDKPlatformKind : String {
243
+ public enum SDKPlatformKind : String , CaseIterable {
244
244
case macosx
245
245
case iphoneos
246
246
case iphonesimulator
@@ -288,9 +288,9 @@ public final class DarwinToolchain: Toolchain {
288
288
let keyedContainer = try decoder. container ( keyedBy: CodingKeys . self)
289
289
290
290
self . versionString = try keyedContainer. decode ( String . self, forKey: . version)
291
- self . canonicalName = try keyedContainer. decode ( String . self, forKey: . canonicalName)
292
- let verRange = canonicalName. range ( of : versionString ) !
293
- self . platformKind = SDKPlatformKind ( rawValue : String ( canonicalName [ ..< verRange . lowerBound ] ) ) ?? SDKPlatformKind . unknown
291
+ let canonicalName = try keyedContainer. decode ( String . self, forKey: . canonicalName)
292
+ self . platformKind = SDKPlatformKind . allCases . first { canonicalName. hasPrefix ( $0 . rawValue ) } ?? SDKPlatformKind . unknown
293
+ self . canonicalName = canonicalName
294
294
guard let version = try ? Version ( versionString: versionString, usesLenientParsing: true ) else {
295
295
throw DecodingError . dataCorruptedError ( forKey: . version,
296
296
in: keyedContainer,
You can’t perform that action at this time.
0 commit comments