MCPcopy Index your code
hub / github.com/getsentry/XcodeBuildMCP / getDefaultSimulatorIndex

Function getDefaultSimulatorIndex

src/cli/commands/setup.ts:536–557  ·  view source on GitHub ↗
(
  simulators: ListedSimulator[],
  existingSimulatorId?: string,
  existingSimulatorName?: string,
)

Source from the content-addressed store, hash-verified

534}
535
536function getDefaultSimulatorIndex(
537 simulators: ListedSimulator[],
538 existingSimulatorId?: string,
539 existingSimulatorName?: string,
540): number {
541 if (existingSimulatorId != null) {
542 const byId = simulators.findIndex((simulator) => simulator.udid === existingSimulatorId);
543 if (byId >= 0) {
544 return byId;
545 }
546 }
547
548 if (existingSimulatorName != null) {
549 const byName = simulators.findIndex((simulator) => simulator.name === existingSimulatorName);
550 if (byName >= 0) {
551 return byName;
552 }
553 }
554
555 const booted = simulators.findIndex((simulator) => simulator.state === 'Booted');
556 return booted >= 0 ? booted : 0;
557}
558
559async function selectSimulator(opts: {
560 existingSimulatorId?: string;

Callers 1

selectSimulatorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected