Skip to content

Commit 238ac71

Browse files
authored
Merge pull request #523 from XcodesOrg/fix-missing-runtime
fix runtime not appearing when multiple runtimes exist for same build
2 parents e9a95a3 + 8534e28 commit 238ac71

4 files changed

Lines changed: 6 additions & 6 deletions

File tree

Xcodes/Backend/AppState+Runtimes.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ extension AppState {
1515
var updatedRuntime = runtime
1616

1717
// This loops through and matches up the simulatorVersion to the mappings
18-
let simulatorBuildUpdate = downloadableRuntimes.sdkToSimulatorMappings.first { SDKToSimulatorMapping in
18+
let simulatorBuildUpdate = downloadableRuntimes.sdkToSimulatorMappings.filter { SDKToSimulatorMapping in
1919
SDKToSimulatorMapping.simulatorBuildUpdate == runtime.simulatorVersion.buildUpdate
2020
}
21-
updatedRuntime.sdkBuildUpdate = simulatorBuildUpdate?.sdkBuildUpdate
21+
updatedRuntime.sdkBuildUpdate = simulatorBuildUpdate.map { $0.sdkBuildUpdate }
2222
return updatedRuntime
2323
}
2424

Xcodes/Frontend/InfoPane/InfoPane.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,12 @@ var xcodeDict: [XcodePreviewName: Xcode] = [
147147
var downloadableRuntimes: [DownloadableRuntime] = {
148148
var runtimes = try! JSONDecoder().decode([DownloadableRuntime].self, from: Current.files.contents(atPath: Path.runtimeCacheFile.string)!)
149149
// set iOS to installed
150-
let iOSIndex = runtimes.firstIndex { $0.sdkBuildUpdate == "19E239" }!
150+
let iOSIndex = 0//runtimes.firstIndex { $0.sdkBuildUpdate.contains == "19E239" }!
151151
var iOSRuntime = runtimes[iOSIndex]
152152
iOSRuntime.installState = .installed
153153
runtimes[iOSIndex] = iOSRuntime
154154

155-
let watchOSIndex = runtimes.firstIndex { $0.sdkBuildUpdate == "20R362" }!
155+
let watchOSIndex = 0//runtimes.firstIndex { $0.sdkBuildUpdate.first == "20R362" }!
156156
var runtime = runtimes[watchOSIndex]
157157
runtime.installState = .installing(
158158
RuntimeInstallationStep.downloading(

Xcodes/Frontend/InfoPane/PlatformsView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ struct PlatformsView: View {
1919
let builds = xcode.sdks?.allBuilds()
2020
let runtimes = builds?.flatMap { sdkBuild in
2121
appState.downloadableRuntimes.filter {
22-
$0.sdkBuildUpdate == sdkBuild
22+
$0.sdkBuildUpdate?.contains(sdkBuild) ?? false
2323
}
2424
}
2525

Xcodes/XcodesKit/Sources/XcodesKit/Models/Runtimes/Runtimes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public struct DownloadableRuntime: Codable, Identifiable, Hashable {
3030

3131
// dynamically updated - not decoded
3232
public var installState: RuntimeInstallState = .notInstalled
33-
public var sdkBuildUpdate: String?
33+
public var sdkBuildUpdate: [String]?
3434

3535
enum CodingKeys: CodingKey {
3636
case category

0 commit comments

Comments
 (0)