
Programmatically get iOS, iPadOS, macOS Catalyst Operating System Name and Version and a model identifier of iPhone, iPad, and Mac devices.
Here is a simple way to programmatically get the operating system name and version of your iOS, iPadOS and macOS.
The code below will also return the value of the iPhone, iPad, and Mac Model identifiers to help you determine whether the device is a MacBook or iMac in a Mac case, an iPhone 11 Pro, or an iPhone 13 Pro.
Step 01:
First, import IOKit. It is only required for macOS Catalyst app-specific code.