Apple’s product line is diverse, and here we have collected some of them in a table to help you identify the specific model of your device.
-- Use this function to perform your initial setup
function setup()
local mydm = deviceMetrics()
for k,v in pairs(mydm) do
print(k,v)
end
print("This device is: ", deviceInfo[mydm.platform].typename)
end
-- This function gets called once every frame
function draw()
-- This sets a dark background color
background(40, 40, 50)
end
--iPhone
deviceInfo = {
["iPhone3,1"] = { platform="iPhone3,1", typename = "iPhone 4"},
["iPhone3,2"] = { platform="iPhone3,2", typename = "Verizon iPhone 4"},
["iPhone3,3"] = { platform="iPhone3,3", typename = "iPhone 4"},
["iPhone4,1"] = { platform="iPhone4,1", typename = "iPhone 4S"},
["iPhone5,1"] = { platform="iPhone5,1", typename = "iPhone 5"},
["iPhone5,2"] = { platform="iPhone5,2", typename = "iPhone 5 (GSM+CDMA)"},
["iPhone5,3"] = { platform="iPhone5,3", typename = "iPhone 5c (GSM)"},
["iPhone5,4"] = { platform="iPhone5,4", typename = "iPhone 5c (GSM+CDMA)"},
["iPhone6,1"] = { platform="iPhone6,1", typename = "iPhone 5s (GSM)"},
["iPhone6,2"] = { platform="iPhone6,2", typename = "iPhone 5s (GSM+CDMA)"},
["iPhone7,1"] = { platform="iPhone7,1", typename = "iPhone 6 Plus"},
["iPhone7,2"] = { platform="iPhone7,2", typename = "iPhone 6"},
["iPhone8,1"] = { platform="iPhone8,1", typename = "iPhone 6s"},
["iPhone8,2"] = { platform="iPhone8,2", typename = "iPhone 6s Plus"},
["iPhone8,4"] = { platform="iPhone8,4", typename = "iPhone SE"},
["iPhone9,1"] = { platform="iPhone9,1", typename = "iPhone 7"}, --国行、日版、港行
["iPhone9,2"] = { platform="iPhone9,2", typename = "iPhone 7 Plus"}, --国行、港行
["iPhone9,3"] = { platform="iPhone9,3", typename = "iPhone 7"}, --美版、台版
["iPhone9,4"] = { platform="iPhone9,4", typename = "iPhone 7 Plus"}, --美版、台版
["iPhone10,1"] = { platform="iPhone10,1", typename = "iPhone 8"}, --国行(A1863)、日行(A1906)
["iPhone10,2"] = { platform="iPhone10,2", typename = "iPhone 8 Plus"}, --国行(A1864)、日行(A1898)
["iPhone10,3"] = { platform="iPhone10,3", typename = "iPhone X"}, --国行(A1865)、日行(A1902)
["iPhone10,4"] = { platform="iPhone10,4", typename = "iPhone 8"}, --美版(Global/A1905)
["iPhone10,5"] = { platform="iPhone10,5", typename = "iPhone 8 Plus"}, --美版(Global/A1897)
["iPhone10,6"] = { platform="iPhone10,6", typename = "iPhone X"}, --美版(Global/A1901)
["iPhone10,8"] = { platform="iPhone11,8", typename = "iPhone XR"},
["iPhone11,2"] = { platform="iPhone11,2", typename = "iPhone XS"},
["iPhone11,6"] = { platform="iPhone11,6", typename = "iPhone XS Max"},
["iPhone11,4"] = { platform="iPhone11,4", typename = "iPhone XS Max"},
["iPhone12,1"] = { platform="iPhone12,1", typename = "iPhone 11"},
["iPhone12,3"] = { platform="iPhone12,3", typename = "iPhone 11 Pro"},
["iPhone12,5"] = { platform="iPhone12,5", typename = "iPhone 11 Pro Max"},
["iPhone12,8"] = { platform="iPhone12,8", typename = "iPhone SE"}, --(2nd generation)
["iPhone13,1"] = { platform="iPhone13,1", typename = "iPhone 12 mini"},
["iPhone13,2"] = { platform="iPhone13,2", typename = "iPhone 12"},
["iPhone13,3"] = { platform="iPhone13,3", typename = "iPhone 12 Pro"},
["iPhone13,4"] = { platform="iPhone13,4", typename = "iPhone 12 Pro Max"},
["iPhone14,2"] = { platform="iPhone14,2", typename = "iPhone 13 Pro"},
["iPhone14,3"] = { platform="iPhone14,3", typename = "iPhone 13 Pro Max"},
["iPhone14,4"] = { platform="iPhone14,4", typename = "iPhone 13 mini"},
["iPhone14,5"] = { platform="iPhone14,5", typename = "iPhone 13"},
["iPhone14,6"] = { platform="iPhone14,6", typename = "iPhone SE"}, --(2nd generation)
["iPhone14,7"] = { platform="iPhone14,7", typename = "iPhone 14"},
["iPhone14,8"] = { platform="iPhone14,8", typename = "iPhone 14 Plus"},
["iPhone15,2"] = { platform="iPhone15,2", typename = "iPhone 14 Pro"},
["iPhone15,3"] = { platform="iPhone15,3", typename = "iPhone 14 Pro Max"},
--iPad
["iPad1,1"] = { platform="iPad1,1", typename = "iPad"},
["iPad1,2"] = { platform="iPad1,2", typename = "iPad 3G"},
["iPad2,1"] = { platform="iPad2,1", typename = "iPad 2 (WiFi)"},
["iPad2,2"] = { platform="iPad2,2", typename = "iPad 2"},
["iPad2,3"] = { platform="iPad2,3", typename = "iPad 2 (CDMA)"},
["iPad2,4"] = { platform="iPad2,4", typename = "iPad 2"},
["iPad2,5"] = { platform="iPad2,5", typename = "iPad Mini (WiFi)"},
["iPad2,6"] = { platform="iPad2,6", typename = "iPad Mini"},
["iPad2,7"] = { platform="iPad2,7", typename = "iPad Mini (GSM+CDMA)"},
["iPad3,1"] = { platform="iPad3,1", typename = "iPad 3 (WiFi)"},
["iPad3,2"] = { platform="iPad3,2", typename = "iPad 3 (GSM+CDMA)"},
["iPad3,3"] = { platform="iPad3,3", typename = "iPad 3"},
["iPad3,4"] = { platform="iPad3,4", typename = "iPad 4 (WiFi)"},
["iPad3,5"] = { platform="iPad3,5", typename = "iPad 4"},
["iPad3,6"] = { platform="iPad3,6", typename = "iPad 4 (GSM+CDMA)"},
["iPad4,1"] = { platform="iPad4,1", typename = "iPad Air (WiFi)"},
["iPad4,2"] = { platform="iPad4,2", typename = "iPad Air (Cellular)"},
["iPad4,3"] = { platform="iPad4,3", typename = "iPad Air"},
["iPad4,4"] = { platform="iPad4,4", typename = "iPad Mini 2 (WiFi)"},
["iPad4,5"] = { platform="iPad4,5", typename = "iPad Mini 2 (Cellular)"},
["iPad4,6"] = { platform="iPad4,6", typename = "iPad Mini 2"},
["iPad4,7"] = { platform="iPad4,7", typename = "iPad Mini 3"},
["iPad4,8"] = { platform="iPad4,8", typename = "iPad Mini 3"},
["iPad4,9"] = { platform="iPad4,9", typename = "iPad Mini 3"},
["iPad5,1"] = { platform="iPad5,1", typename = "iPad Mini 4 (WiFi)"},
["iPad5,2"] = { platform="iPad5,2", typename = "iPad Mini 4 (LTE)"},
["iPad5,3"] = { platform="iPad5,3", typename = "iPad Air 2"},
["iPad5,4"] = { platform="iPad5,4", typename = "iPad Air 2"},
["iPad6,3"] = { platform="iPad6,3", typename = "iPad Pro 9.7"},
["iPad6,4"] = { platform="iPad6,4", typename = "iPad Pro 9.7"},
["iPad6,7"] = { platform="iPad6,7", typename = "iPad Pro 12.9"},
["iPad6,8"] = { platform="iPad6,8", typename = "iPad Pro 12.9"},
["iPad6,11"] = { platform="iPad6,11", typename = "iPad 5th"},
["iPad6,12"] = { platform="iPad6,12", typename = "iPad 5th"},
["iPad7,1"] = { platform="iPad7,1", typename = "iPad Pro 12.9 2nd"},
["iPad7,2"] = { platform="iPad7,2", typename = "iPad Pro 12.9 2nd"},
["iPad7,3"] = { platform="iPad7,3", typename = "iPad Pro 10.5"},
["iPad7,4"] = { platform="iPad7,4", typename = "iPad Pro 10.5"},
["iPad7,5"] = { platform="iPad7,5", typename = "iPad 6th"},
["iPad7,6"] = { platform="iPad7,6", typename = "iPad 6th"},
["iPad8,1"] = { platform="iPad8,1", typename = "iPad Pro 11"},
["iPad8,2"] = { platform="iPad8,2", typename = "iPad Pro 11"},
["iPad8,3"] = { platform="iPad8,3", typename = "iPad Pro 11"},
["iPad8,4"] = { platform="iPad8,4", typename = "iPad Pro 11"},
["iPad8,5"] = { platform="iPad8,5", typename = "iPad Pro 12.9 3rd"},
["iPad8,6"] = { platform="iPad8,6", typename = "iPad Pro 12.9 3rd"},
["iPad8,7"] = { platform="iPad8,7", typename = "iPad Pro 12.9 3rd"},
["iPad8,8"] = { platform="iPad8,8", typename = "iPad Pro 12.9 3rd"},
["iPad11,1"] = { platform="iPad11,1", typename = "iPad mini 5th"},
["iPad11,2"] = { platform="iPad11,2", typename = "iPad mini 5th"},
["iPad11,3"] = { platform="iPad11,3", typename = "iPad Air 3rd"},
["iPad11,4"] = { platform="iPad11,4", typename = "iPad Air 3rd"},
["iPad11,6"] = { platform="iPad11,6", typename = "iPad 8th"},
["iPad11,7"] = { platform="iPad11,7", typename = "iPad 8th"},
["iPad12,1"] = { platform="iPad12,1", typename = "iPad 9th"},
["iPad12,2"] = { platform="iPad12,2", typename = "iPad 9th"},
["iPad14,1"] = { platform="iPad14,1", typename = "iPad mini 6th"},
["iPad14,2"] = { platform="iPad14,2", typename = "iPad mini 6th"},
--iPod
["iPad1,1"] = { platform="iPod1,1", typename = "iPod Touch 1G"},
["iPad2,1"] = { platform="iPod2,1", typename = "iPod Touch 2G"},
["iPad3,1"] = { platform="iPod3,1", typename = "iPod Touch 3G"},
["iPad4,1"] = { platform="iPod4,1", typename = "iPod Touch 4G"},
["iPad5,1"] = { platform="iPod5,1", typename = "iPod Touch (5 Gen)"},
["iPad7,1"] = { platform="iPod7,1", typename = "iPod Touch (6 Gen)"},
["iPad9,1"] = { platform="iPod9,1", typename = "iPod Touch (7 Gen)"},
["i386"] = { platform="i386", typename = "Simulator"},
["x86_64"] = { platform="x86_64", typename = "Simulator"},
}
Run it you will get below:
batteryState unplugged
platformName Unknown iPad
platform iPad8,5
batteryLevel 0.69999998807907
systemName iPadOS
systemVersion 17.3.1
name iPad
hwmodel J320AP
This device is: iPad Pro 12.9 3rd