@@ -27,7 +27,11 @@ import {getConfiguration} from '../buildCommand/getConfiguration';
2727import { getXcodeProjectAndDir } from '../buildCommand/getXcodeProjectAndDir' ;
2828import { getFallbackSimulator } from './getFallbackSimulator' ;
2929import { getPlatformInfo } from './getPlatformInfo' ;
30- import { printFoundDevices , matchingDevice } from './matchingDevice' ;
30+ import {
31+ printFoundDevices ,
32+ matchingDevice ,
33+ formattedDeviceName ,
34+ } from './matchingDevice' ;
3135import { runOnDevice } from './runOnDevice' ;
3236import { runOnSimulator } from './runOnSimulator' ;
3337import { BuilderCommand } from '../../types' ;
@@ -326,7 +330,7 @@ const createRun =
326330 mode ,
327331 scheme ,
328332 args ,
329- fallbackSimulator ,
333+ device ,
330334 ) ;
331335 } else {
332336 if ( ! device ) {
@@ -392,6 +396,32 @@ const createRun =
392396 args ,
393397 ) ;
394398 }
399+ } else if ( args . simulator ) {
400+ const matchedSimulator = devices . find (
401+ ( d ) =>
402+ d . type === 'simulator' &&
403+ ( d . udid === args . simulator ||
404+ d . name === args . simulator ||
405+ formattedDeviceName ( d ) === args . simulator ) ,
406+ ) ;
407+
408+ if ( ! matchedSimulator ) {
409+ logger . warn (
410+ `Could not find a simulator with name or UDID: "${ pico . bold (
411+ args . simulator ,
412+ ) } ". ${ printFoundDevices ( devices , 'simulator' ) } `,
413+ ) ;
414+ logger . info ( 'Falling back to default simulator...' ) ;
415+ }
416+
417+ return runOnSimulator (
418+ xcodeProject ,
419+ platformName ,
420+ mode ,
421+ scheme ,
422+ args ,
423+ matchedSimulator ?? fallbackSimulator ,
424+ ) ;
395425 } else {
396426 runOnSimulator (
397427 xcodeProject ,
0 commit comments