in lib/utils/utilities.js [145:179]
function getSimulatorData (findSimResult) {
if (simulatorDataCollection[findSimResult]) return simulatorDataCollection[findSimResult];
// Format of the output is "iPhone-6s-Plus, 9.1"
// Extract the device name and the version number
const split = findSimResult.split(', ');
// The target simulator data
const simulatorData = {
device: split[0].replace(/-/g, ' ').trim(),
version: split[1].trim()
};
// Fetch the environment's installed simulator collection data
const simulators = getSimulatorCollection();
// Try to find the simulator ids from the simulator collection
const simulatorIds = filterForSimulatorIds(simulatorData, simulators);
// Warn if no data was found.
if (simulatorIds.length === 0) {
logger.error('No simulator found.');
} else if (simulatorIds.length > 1) {
logger.warn('Multiple matching simulators found. Will use the first matching simulator');
}
// Add the Simulator ID to the Simulator Data object
simulatorData.simId = simulatorIds[0];
// Update the Simulator Data Collection
simulatorDataCollection[findSimResult] = simulatorData;
// Return the newly created Simulator Data object
return simulatorDataCollection[findSimResult];
}