Usually, I use the below code to identify the iOS version of the device.
if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0)
In
On iOS, you should just check MTLCreateSystemDefaultDevice()
. If it returns a valid device, you’re good to go. On macOS, you need to be careful; use [MTLCopyAllDevices() count]
to determine if you have any supported metal devices available.
You should avoid using MTLCreateSystemDefaultDevice()
on macOS because that can force a mux switch to the discrete GPU (eg: if you're dealing with a laptop with automatic graphics switching between a discrete and integrated graphics).