if Platform.isSimulator { // Do one thing print("isSimulator") } else { } struct Platform { static let isSimulator: Bool = { var isSim = false #if arch(i386) || arch(x86_64) isSim = true #endif return isSim }() }