I would like to detect test device is iPod or iPhone. Now, I'm using this code.
if (UIDevice.current.userInterfaceIdiom == UIUserInterfaceIdiom.pad)
{ debugPrint("ipad show")
}
else
{
debugPrint("ipod show")
}
When I test with iPhone 7, it shows iPod. So, I would like to detect whether it is iPod or iPhone.
I don't want to install any additional pod to achieve this.
I would like to implement this with simply and short code.
Can anyone help me please?
You can get it better by making an extension for UIDevice like:
Usage:
UIDevice.current.modelNameThis will return the device model in string.Try to use it like: