Check out example codes for "swift test if simulator". It will help you in understanding the concepts better.

Code Example 1

#if targetEnvironment(simulator)
  // your simulator code
#else
  // your real device code
#endif

Learn ReactJs, React Native from akashmittal.com