#if targetEnvironment device 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