Most answers on SO seem to want to know how to detect if the simulator is running.
I know that it is.
I want to determine what device the simulator is simulating?
I want to read something like "I am simulating an iPhone 15 Pro Max (for example)"
How do I do this? Where can I find this data?
You can use this:
let str = ProcessInfo().environment["SIMULATOR_MODEL_IDENTIFIER"]
to get the model string in this format:
"iPhone14,6"
...
"iPhone16,1"
...
"iPad13,8"
...
etc
and so on... and you'd commonly use a Model lookup table to get the "friendly" name.
You can also use this:
let str = ProcessInfo().environment["SIMULATOR_DEVICE_NAME"]
which returns:
"iPhone SE (3rd generation)"
...
"iPhone 15 Pro"
...
"iPad Pro (11-inch) (4th generation)"
...
etc
without the need for the lookup table.