Skip to content

Commit

Permalink
Merge pull request #523 from XcodesOrg/fix-missing-runtime
Browse files Browse the repository at this point in the history
fix runtime not appearing when multiple runtimes exist for same build
  • Loading branch information
MattKiazyk authored Mar 8, 2024
2 parents e9a95a3 + 8534e28 commit 238ac71
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Xcodes/Backend/AppState+Runtimes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ extension AppState {
var updatedRuntime = runtime

// This loops through and matches up the simulatorVersion to the mappings
let simulatorBuildUpdate = downloadableRuntimes.sdkToSimulatorMappings.first { SDKToSimulatorMapping in
let simulatorBuildUpdate = downloadableRuntimes.sdkToSimulatorMappings.filter { SDKToSimulatorMapping in
SDKToSimulatorMapping.simulatorBuildUpdate == runtime.simulatorVersion.buildUpdate
}
updatedRuntime.sdkBuildUpdate = simulatorBuildUpdate?.sdkBuildUpdate
updatedRuntime.sdkBuildUpdate = simulatorBuildUpdate.map { $0.sdkBuildUpdate }
return updatedRuntime
}

Expand Down
4 changes: 2 additions & 2 deletions Xcodes/Frontend/InfoPane/InfoPane.swift
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,12 @@ var xcodeDict: [XcodePreviewName: Xcode] = [
var downloadableRuntimes: [DownloadableRuntime] = {
var runtimes = try! JSONDecoder().decode([DownloadableRuntime].self, from: Current.files.contents(atPath: Path.runtimeCacheFile.string)!)
// set iOS to installed
let iOSIndex = runtimes.firstIndex { $0.sdkBuildUpdate == "19E239" }!
let iOSIndex = 0//runtimes.firstIndex { $0.sdkBuildUpdate.contains == "19E239" }!
var iOSRuntime = runtimes[iOSIndex]
iOSRuntime.installState = .installed
runtimes[iOSIndex] = iOSRuntime

let watchOSIndex = runtimes.firstIndex { $0.sdkBuildUpdate == "20R362" }!
let watchOSIndex = 0//runtimes.firstIndex { $0.sdkBuildUpdate.first == "20R362" }!
var runtime = runtimes[watchOSIndex]
runtime.installState = .installing(
RuntimeInstallationStep.downloading(
Expand Down
2 changes: 1 addition & 1 deletion Xcodes/Frontend/InfoPane/PlatformsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct PlatformsView: View {
let builds = xcode.sdks?.allBuilds()
let runtimes = builds?.flatMap { sdkBuild in
appState.downloadableRuntimes.filter {
$0.sdkBuildUpdate == sdkBuild
$0.sdkBuildUpdate?.contains(sdkBuild) ?? false
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public struct DownloadableRuntime: Codable, Identifiable, Hashable {

// dynamically updated - not decoded
public var installState: RuntimeInstallState = .notInstalled
public var sdkBuildUpdate: String?
public var sdkBuildUpdate: [String]?

enum CodingKeys: CodingKey {
case category
Expand Down

0 comments on commit 238ac71

Please sign in to comment.