Skip to content

robegamesios/iOS-XcodeMultiSim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

iOS-XcodeMultiSim

Build once and run multiple Simulators in Xcode or CLI. Tested on Xcode 15.4

Youtube video: https://youtu.be/rEm9NqzoHE0?si=eKRU5rLv8cHNA3i4

STEPS

a. Copy the script file buildAndRunMultipleSimulators.sh and paste in on your project root directory.

b. Open the script file and change the following:

  1. project name - Go to Xcode -> Settings -> Locations -> Derived Data. Your project name is before the random characters. For example in SwiftUI-WeatherApp-fyrnhrghniuvzdcfowvoxagsnypn, your project name is SwiftUI-WeatherApp.

  2. app name - Look at your project directory, your app name has extension of .xcodeproj

  3. scheme - At the top of Xcode IDE, left of the simulator name

  4. bundle identifier - Go to Targets -> General, under Identity section

Screenshot 2024-08-31 at 1 38 49 PM

c. Edit the buildAndRunMultipleSimulators.sh script:

  1. Update the variables

  2. Update the simulators by name or identifier

Screenshot 2024-09-01 at 8 30 17 AM

d. Open Run destinations Cmd+Shift+2 then do the following: a. Select Simulators and click (+) to add a new run destination b. Name the simulator iPhone15+MultiSim or anything you like. You will need this name later c. Select iPhone 15 for the Device Type d. Click Create

Screenshot 2024-08-31 at 1 44 09 PM

e. Go to Project Navigator, then select the Project, then select the Target.

  1. In Build Phases tab, add a new Run Script and paste the code below.
custom_sim=`xcrun simctl list | grep 'iPhone15+MultiSim' | awk -F'[()]' '{print $2}'`
if [ ! -z "${custom_sim}" ] && [ "${TARGET_DEVICE_IDENTIFIER}" = "${custom_sim}" ]; then
/bin/sh buildAndRunMultipleSimulators.sh
fi
  1. If you named your script to something else, then update the filename in the script

  2. If you named your simulator to something else, then update the name in the script (grep 'iPhone15+MultiSim')

  3. You can also rename the run script

Screenshot 2024-08-31 at 1 45 54 PM

f. Select iPhone15+MultiSim as your simulator and run the project.

About

Build once and run multiple Simulators in Xcode or CLI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published