iOS Simulators — Tricks & Tips

Viewing/Adding A Simulator

You can change or add simulators by going to Product > Destination. To add, select Add Additional Simulators.

You can also access the list of simulators from the top toolbar by selecting the currently selected simulator:

From the Add Simulator options, you can select the “+” in the bottom left corner to create a new simulator as shown below:

To View the list of simulators from command line, run the following command:

xcrun simctl list

To add a new simulator from command line, run the following:

xcrun simctl create <simulator name> <sim device type> <sim runtime>Example: 
xcrun simctl iPhoneSEGen2 com.apple.CoreSimulator.SimDeviceType.iPhone-SE--2nd-generation- com.apple.CoreSimulator.SimRuntime.iOS-15-2

Clearing the Simulator

Sometimes you want to clear the simulator to put it back in the starting state. You can do this by selecting the simulator and then going to the Device menu and selecting Erase All Contents and Settings.

From the command line, you can also kill all simulators by running the following commands. The last two can be used if you are using simulator clones (for parallel testing).

osascript -e 'tell application "iOS Simulator" to quit' 
osascript -e 'tell application "Simulator" to quit'
xcrun simctl erase all
xcrun simctl --set testing shutdown all
xcrun simctl --set testing erase all

Simulator Clones

If you want to use simulator clones for parallel testing, go to Product > Scheme > Edit Scheme. Select Test. If you don’t have Test Plans enabled for the scheme, then you can select Options > Execute in Parallel. If you do have Test Plans enabled, select the Test Plan > button and change parallelizable to be true.

If you want to run tests via command line in parallel and specify the number of simulators to use, you can use certain parameters for the xcodebuild command:

xcodebuild ...-parallel-testing-enabled YES
-parallel-testing-worker-count 2
...

If you aren’t seeing the simulator clones, make sure this option is checked:

Simulator Keyboard

When you select on a text field in the simulator manually or during a test, the keyboard may — or may not — appear. If its not doing what you need try toggling these keyboard settings:

Simulator — Stop Hiding!

If you want to make sure you can always view watch/view your simulator, then select the Stay On Top option from the Window menu:

Test Engineer Expert, Dog Mom

Love podcasts or audiobooks? Learn on the go with our new app.

Building a better marketplace

PhoneMe App iOS/Android Update #1 — Almost there

Android Oreo Background Execution Limits

In this article I am going to tell What is Amazon SQS and its usecases So, let’s get Started

6 Python Data Science Interview Questions in 2021

Data Science InterviewPython Data Science Interview Questions in 2021 Data Manipulation and String Extraction

Universal Login Beta 3: Gnosis Safe Support & More

Thinking MVP with Android

How to build react-native iOS CI/CD pipeline using Github Actions + Ms AppCenter

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ronell Lukasik

Ronell Lukasik

Test Engineer Expert, Dog Mom

More from Medium

iOS Stack Weekly — Issue #2

The Swift Practice Summary in January 2022

Closures in swift

Difference between == and === operators in Swift