Как определить текущую модель iPhone/устройства? ⇐ IOS
-
Anonymous
Как определить текущую модель iPhone/устройства?
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
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
Мобильная версия