« Back

Running multiple iOS simulators with React Native.

Whist developing an app for React Native I wanted to be able to compare the iPhone version vs the iPad version; basically a slightly different layout between the two.

xcode doesn't allow multiple simulators to run and attach to it's debugger but you can run multiple simulators together:

cd /Applications/Xcode.app/Contents/Developer/Applications  
open -n Simulator.app  
open -n Simulator.app  

Once open, the simulator hardware can be changed to the desired platform. The problem with this is however getting the apps onto the simulators, and running them both. It's also a pain to have to change each simulator hardware every time it opens.

I modified the react-native run-ios command to allow multiple simulators to be spawned, built against, and run with the RN app. The command is:

`react-native run-ios --simulator "iPhone 6, iPad Retina"

Where the --simulator flag is a CSV of simulators available (checked against xcrun simctl list devices).

Here is is in action:

When https://github.com/facebook/react-native/pull/6179 get's merged, hot loading works too!

comments powered by Disqus