-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent keyNotFound error with unknown simulators #261
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,18 +38,16 @@ public class RuntimeInstaller { | |
} | ||
} | ||
|
||
|
||
|
||
|
||
let unusableCount = installed.removeAll { $0.state == "Unusable" }.count | ||
installed.forEach { runtime in | ||
let resolvedBetaNumber = downloadablesResponse.sdkToSeedMappings.first { | ||
$0.buildUpdate == runtime.build | ||
$0.buildUpdate == runtime.build! | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we refactor this section a bit? Can we not use force unwrap. As a rule, I don't use them. Totally agree that it should never happen but it's bitten me in the past. Perhaps making an overloaded There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure how best to achieve this, feel free to make any changes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just my 2 cents here, personally I also try to avoid them if I can, but in this case, I would prefer a force unwrap to fail than hiding the error and providing an empty string as a default value, in that case, we would know that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @MattKiazyk can you please give an update on how you would like to proceed here? |
||
}?.seedNumber | ||
|
||
var result = PrintableRuntime(platform: runtime.platformIdentifier.asPlatformOS, | ||
var result = PrintableRuntime(platform: runtime.platformIdentifier!.asPlatformOS, | ||
betaNumber: resolvedBetaNumber, | ||
version: runtime.version, | ||
build: runtime.build, | ||
version: runtime.version!, | ||
build: runtime.build!, | ||
state: runtime.kind) | ||
|
||
mappedRuntimes.indices { | ||
|
@@ -90,6 +88,9 @@ public class RuntimeInstaller { | |
} | ||
} | ||
Current.logging.log("\nNote: Bundled runtimes are indicated for the currently selected Xcode, more bundled runtimes may exist in other Xcode(s)") | ||
if unusableCount > 0 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like this vs having the original |
||
Current.logging.log("Note: Found \(unusableCount) unknown downloaded runtime(s). For more info run `xcrun simctl runtime list -j`.") | ||
} | ||
} | ||
|
||
public func downloadAndInstallRuntime(identifier: String, to destinationDirectory: Path, with downloader: Downloader, shouldDelete: Bool) async throws { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#picky can we add a comment on why these are optional