Как определить текущую модель iPhone/устройства?IOS

Программируем под IOS
Anonymous
Как определить текущую модель iPhone/устройства?

Сообщение Anonymous »


Is there a way to get the device model name (iPhone 4S, iPhone 5, iPhone 5S, etc) in Swift?

I know there is a property named UIDevice.currentDevice().model but it only returns device type (iPod touch, iPhone, iPad, iPhone Simulator, etc).

I also know it can be done easily in Objective-C with this method:

#import struct utsname systemInfo; uname(&systemInfo); NSString* deviceModel = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding]; But I'm developing my iPhone app in Swift so could someone please help me with the equivalent way to solve this in Swift?


Источник: https://stackoverflow.com/questions/260 ... vice-model

Вернуться в «IOS»