how to find detect if simulator swift code example
Example: swift test if simulator
#if targetEnvironment(simulator)
// your simulator code
#else
// your real device code
#endif
#if targetEnvironment(simulator)
// your simulator code
#else
// your real device code
#endif