I\'d like to know whether my app is being run on device or simulator at run time. Is there a way to detect this?
Reason being to test bluetooth api with simulator:
Use this below code:
#if targetEnvironment(simulator) // iOS Simulator #else // Device #endif
Works for Swift 4 and Xcode 9.4.1
Swift 4
Xcode 9.4.1