How to get device make and model on iOS?

iOSApps/ApplicationsMobile DevelopmentSwift

When we talk about the device make, we refer to the Phone manufacturer (e.g. Apple, Samsung, Nokia and so on) and device model is generally the specific product such as iPhone, iPad/TAB etc.

Any mobile devices will be categorized using make and model only.

Now let’s understand how do I get device make and model in iOS?

There are two ways to get make and model the first way is to directly open your iOS device, navigate to setting, tap on general and in the about section you can find the details of your iOS device

The second way is getting make and model using

Open Xcode → New Project and add the below code in ViewController’s viewDidLoad method.

let modelName = UIDevice.current.model
let name = UIDevice.current.name

print(modelName) // iPhone
print(name) // iPhone XR

UIDevice.current.model, gives you a model whether you have an iPhone, iPad, UIDevice.current.name gives you a name identifying the device.


raja
Published on 25-Apr-2019 12:51:19
Advertisements