I'm starting with swift and I need to get the exact IPHONE template from the client, I already tried UIDevice returns Iphone or Ipad and I need to know if the device is an SE, 7, 8+, X, etc. Does anyone know how to do it?
I'm starting with swift and I need to get the exact IPHONE template from the client, I already tried UIDevice returns Iphone or Ipad and I need to know if the device is an SE, 7, 8+, X, etc. Does anyone know how to do it?
Opa came to take a look at this answer? link
This function seems to return what you need
func modelIdentifier() -> String {
if let simulatorModelIdentifier = ProcessInfo().environment["SIMULATOR_MODEL_IDENTIFIER"] { return simulatorModelIdentifier }
var sysinfo = utsname()
uname(&sysinfo) // ignore return value
return String(bytes: Data(bytes: &sysinfo.machine, count: Int(_SYS_NAMELEN)), encoding: .ascii)!.trimmingCharacters(in: .controlCharacters)
}