I tried to build the project with Xcode 16.3 and I initially got an error that TARGET_IPHONE_SIMULATOR does not exist, then I changed this flag to TARGET_OS_SIMULATOR, but it did not solve the problem
Cannot find 'TARGET_OS_SIMULATOR' in the scope
I fix like this
#if targetEnvironment(simulator)
let isARMSimulator: Bool
#if arch(arm64)
isARMSimulator = true
#else
isARMSimulator = false
#endif
#else
let isARMSimulator = false
#endif
Recommended
You’re definitely on the right track here. TARGET_OS_SIMULATOR
is the correct choice for C-based language but it’s best to avoid it in Swift. Rather, use targetEnvironment(simulator)
.
Why do you care about the difference between the Apple silicon on Intel simulators?
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"