Apple mobile device types(苹果移动设备

2023-11-08  本文已影响0人  Coder_Cat
extension String {
    
    ///获取硬件设备类型标识
    public static func devicemodel() -> String {
        var systemInfo = utsname()

        uname(&systemInfo)

        let machineMirror = Mirror(reflecting: systemInfo.machine)

        let identifier = machineMirror.children.reduce("") { identifier, element in

            guard let value = element.value as? Int8, value != 0 else { return identifier }

            return identifier + String(UnicodeScalar(UInt8(value)))
        }

        return identifier
    }
    ///获取设备类型
    public static var deviceType: String {
        let identifier = devicemodel()
        switch identifier {
            case "i386", "x86_64", "arm64":                 return "模拟器设备"
            
            case "iPod1,1":                                 return "1st Gen iPod"
            case "iPod2,1":                                 return "2nd Gen iPod"
            case "iPod3,1":                                 return "3rd Gen iPod"
            case "iPod4,1":                                 return "4th Gen iPod"
            case "iPod5,1":                                 return "5th Gen iPod"
            case "iPod7,1":                                 return "6th Gen iPod"
            case "iPod9,1":                                 return "7th Gen iPod"
            
            case "iPhone3,1", "iPhone3,2", "iPhone3,3":     return "iPhone 4"
            case "iPhone4,1":                               return "iPhone 4s"
            case "iPhone5,1", "iPhone5,2":                  return "iPhone 5"
            case "iPhone5,3", "iPhone5,4":                  return "iPhone 5c"
            case "iPhone6,1", "iPhone6,2":                  return "iPhone 5s"
            case "iPhone7,2":                               return "iPhone 6"
            case "iPhone7,1":                               return "iPhone 6 Plus"
            case "iPhone8,1":                               return "iPhone 6s"
            case "iPhone8,2":                               return "iPhone 6s Plus"
            case "iPhone8,4":                               return "iPhone SE"
            case "iPhone9,1":                               return "iPhone 7 (CDMA)"
            case "iPhone9,2":                               return "iPhone 7 Plus(CDMA)"
            case "iPhone9,3":                               return "iPhone 7 (GSM)"
            case "iPhone9,4":                               return "iPhone 7 Plus (GSM)"
            case "iPhone10,1":                              return "iPhone 8 (CDMA)"
            case "iPhone10,4":                              return "iPhone 8 (GSM)"
            case "iPhone10,2":                              return "iPhone 8 Plus (CDMA)"
            case "iPhone10,5":                              return "iPhone 8 Plus (GSM)"
            case "iPhone10,3":                              return "iPhone X (CDMA)"
            case "iPhone10,6":                              return "iPhone X (GSM)"
            case "iPhone11,2":                              return "iPhone XS"
            case "iPhone11,4":                              return "iPhone XS Max"
            case "iPhone11,6":                              return "iPhone XS Max"
            case "iPhone11,8":                              return "iPhone XR"
            case "iPhone12,1":                              return "iPhone 11"
            case "iPhone12,3":                              return "iPhone 11 Pro"
            case "iPhone12,5":                              return "iPhone 11 Pro Max"
            case "iPhone12,8":                              return "iPhone SE 2"
            case "iPhone13,1":                              return "iPhone 12 Mini"
            case "iPhone13,2":                              return "iPhone 12"
            case "iPhone13,3":                              return "iPhone 12 Pro"
            case "iPhone13,4":                              return "iPhone 12 Pro Max"
            case "iPhone14,4":                              return "iPhone 13 Mini"
            case "iPhone14,5":                              return "iPhone 13"
            case "iPhone14,2":                              return "iPhone 13 Pro"
            case "iPhone14,3":                              return "iPhone 13 Pro Max"
            case "iPhone14,6":                              return "iPhone SE 3"
            case "iPhone14,7":                              return "iPhone 14"
            case "iPhone14,8":                              return "iPhone 14 Plus"
            case "iPhone15,2":                              return "iPhone 14 Pro"
            case "iPhone15,3":                              return "iPhone 14 Pro Max"
            case "iPhone15,4":                              return "iPhone 15"
            case "iiPhone15,5":                             return "iPhone 15 Plus"
            case "iPhone16,1":                              return "iPhone 15 Pro"
            case "iPhone16,2":                              return "iPhone 15 Pro Max"

            case "iPad2,1", "iPad2,2", "iPad2,3", "iPad2,4":    return "iPad 2"
            case "iPad3,1", "iPad3,2", "iPad3,3":               return "iPad 3"
            case "iPad3,4", "iPad3,5", "iPad3,6":               return "iPad 4"
            case "iPad4,1", "iPad4,2", "iPad4,3":               return "iPad Air"
            case "iPad5,3", "iPad5,4":                          return "iPad Air 2"
            case "iPad2,5", "iPad2,6", "iPad2,7":               return "iPad Mini"
            case "iPad4,4", "iPad4,5", "iPad4,6":               return "iPad Mini 2"
            case "iPad4,7", "iPad4,8", "iPad4,9":               return "iPad Mini 3"
            case "iPad5,1", "iPad5,2":                          return "iPad Mini 4"
            case "iPad6,7", "iPad6,8":                          return "iPad Pro"
            case "iPad6,11", "iPad6,12":                        return "iPad (2017)"
            case "iPad7,1", "iPad7,2":                          return "iPad Pro 2nd Gen"
            case "iPad7,3", "iPad7,4":                          return "iPad Pro 10.5-inch 2nd Gen"
            case "iPad7,5", "iPad7,6":                          return "iPad 6th Gen"
            case "iPad7,11", "iPad7,12":                        return "iPad 7th Gen 10.2-inch"
            case "iPad8,1", "iPad8,2", "iPad8,3", "iPad8,4":    return "iPad Pro 11 inch 3rd Gen"
            case "iPad8,5", "iPad8,6", "iPad8,7", "iPad8,8":    return "iPad Pro 12.9 inch 3rd Gen"
            case "iPad8,9", "iPad8,10":                         return "iPad Pro 11 inch 4th Gen"
            case "iPad8,11", "iPad8,12":                        return "iPad Pro 12.9 inch 4th Gen"
            case "iPad11,1 ", "iPad11,2":                       return "iPad mini 5th Gen"
            case "iPad11,3", "iPad11,4":                        return "iPad Air 3rd Gen"
            case "iPad11,6", "iPad11,7":                        return "iPad 8th Gen"
            case "iPad12,1", "iPad12,2":                        return "iPad 9th Gen"
            case "Pad14,1", "Pad14,2":                          return "iPad mini 6th Gen"
            case "iPad13,1", "iPad13,2":                        return "iPad Air 4th Gen"
            case "iPad13,4", "iPad13,5", "iPad13,6", "iPad13,7":    return "iPad Pro 11 inch 5th Gen"
            case "iPad13,8", "iPad13,9", "iPad13,10", "iPad13,11":   return "iPad Pro 12.9 inch 5th Gen"
            case "iPad13,16", "iPad13,17":                      return "iPad Air 5th Gen"
            case "iPad13,18", "iPad13,19":                      return "iPad 10th Gen"
            case "iPad14,3", "iPad14,4":                        return "iPad Pro 11 inch 4th Gen"
            case "iPad14,5", "iPad14,6":                        return "iPad Pro 12.9 inch 6th Gen"
        
            case "Watch1,1", "Watch1,2":                            return "Apple Watch"
            case "Watch2,6", "Watch2,7":                            return "Apple Watch Series 1"
            case "Watch2,3", "Watch2,4":                            return "Apple Watch Series 2"
            case "Watch3,1", "Watch3,2", "Watch3,3", "Watch3,4":    return "Apple Watch Series 3"
            case "Watch4,1", "Watch4,2", "Watch4,3", "Watch4,4":    return "Apple Watch Series 4"
            case "Watch5,1", "Watch5,2", "Watch5,3", "Watch5,4":    return "Apple Watch Series 5"
            case "Watch5,9", "Watch5,10", "Watch5,11", "Watch5,12": return "Apple Watch Series SE"
            case "Watch6,1", "Watch6,2", "Watch6,3", "Watch6,4":    return "Apple Watch Series 6"
            case "Watch6,6", "Watch6,7", "Watch6,8", "Watch6,9":    return "Apple Watch Series 7"
            case "Watch6,10", "Watch6,11", "Watch6,12", "Watch6,13": return "Apple Watch SE"
            case "Watch6,14", "Watch6,15", "Watch6,16", "Watch6,17": return "Apple Watch Series 8"
            case "Watch1,18":                                       return "Apple Watch Ultra"
            case "Watch7,1", "Watch7,2", "Watch7,3", "Watch7,4":    return "Apple Watch Series 9"
            case "Watch7,5":                                        return "Apple Watch Ultra 2"
            
            default:                                        return identifier
        }
    }
}
i386 : iPhone Simulator
x86_64 : iPhone Simulator
arm64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S
iPhone5,1 : iPhone 5 (GSM)
iPhone5,2 : iPhone 5 (GSM+CDMA)
iPhone5,3 : iPhone 5C (GSM)
iPhone5,4 : iPhone 5C (Global)
iPhone6,1 : iPhone 5S (GSM)
iPhone6,2 : iPhone 5S (Global)
iPhone7,1 : iPhone 6 Plus
iPhone7,2 : iPhone 6
iPhone8,1 : iPhone 6s
iPhone8,2 : iPhone 6s Plus
iPhone8,4 : iPhone SE (GSM)
iPhone9,1 : iPhone 7
iPhone9,2 : iPhone 7 Plus
iPhone9,3 : iPhone 7
iPhone9,4 : iPhone 7 Plus
iPhone10,1 : iPhone 8
iPhone10,2 : iPhone 8 Plus
iPhone10,3 : iPhone X Global
iPhone10,4 : iPhone 8
iPhone10,5 : iPhone 8 Plus
iPhone10,6 : iPhone X GSM
iPhone11,2 : iPhone XS
iPhone11,4 : iPhone XS Max
iPhone11,6 : iPhone XS Max Global
iPhone11,8 : iPhone XR
iPhone12,1 : iPhone 11
iPhone12,3 : iPhone 11 Pro
iPhone12,5 : iPhone 11 Pro Max
iPhone12,8 : iPhone SE 2nd Gen
iPhone13,1 : iPhone 12 Mini
iPhone13,2 : iPhone 12
iPhone13,3 : iPhone 12 Pro
iPhone13,4 : iPhone 12 Pro Max
iPhone14,2 : iPhone 13 Pro
iPhone14,3 : iPhone 13 Pro Max
iPhone14,4 : iPhone 13 Mini
iPhone14,5 : iPhone 13
iPhone14,6 : iPhone SE 3rd Gen
iPhone14,7 : iPhone 14
iPhone14,8 : iPhone 14 Plus
iPhone15,2 : iPhone 14 Pro
iPhone15,3 : iPhone 14 Pro Max
iPhone15,4 : iPhone 15
iPhone15,5 : iPhone 15 Plus
iPhone16,1 : iPhone 15 Pro
iPhone16,2 : iPhone 15 Pro Max

iPod1,1 : 1st Gen iPod
iPod2,1 : 2nd Gen iPod
iPod3,1 : 3rd Gen iPod
iPod4,1 : 4th Gen iPod
iPod5,1 : 5th Gen iPod
iPod7,1 : 6th Gen iPod
iPod9,1 : 7th Gen iPod

iPad1,1 : iPad
iPad1,2 : iPad 3G
iPad2,1 : 2nd Gen iPad
iPad2,2 : 2nd Gen iPad GSM
iPad2,3 : 2nd Gen iPad CDMA
iPad2,4 : 2nd Gen iPad New Revision
iPad3,1 : 3rd Gen iPad
iPad3,2 : 3rd Gen iPad CDMA
iPad3,3 : 3rd Gen iPad GSM
iPad2,5 : iPad mini
iPad2,6 : iPad mini GSM+LTE
iPad2,7 : iPad mini CDMA+LTE
iPad3,4 : 4th Gen iPad
iPad3,5 : 4th Gen iPad GSM+LTE
iPad3,6 : 4th Gen iPad CDMA+LTE
iPad4,1 : iPad Air (WiFi)
iPad4,2 : iPad Air (GSM+CDMA)
iPad4,3 : 1st Gen iPad Air (China)
iPad4,4 : iPad mini Retina (WiFi)
iPad4,5 : iPad mini Retina (GSM+CDMA)
iPad4,6 : iPad mini Retina (China)
iPad4,7 : iPad mini 3 (WiFi)
iPad4,8 : iPad mini 3 (GSM+CDMA)
iPad4,9 : iPad Mini 3 (China)
iPad5,1 : iPad mini 4 (WiFi)
iPad5,2 : 4th Gen iPad mini (WiFi+Cellular)
iPad5,3 : iPad Air 2 (WiFi)
iPad5,4 : iPad Air 2 (Cellular)
iPad6,3 : iPad Pro (9.7 inch, WiFi)
iPad6,4 : iPad Pro (9.7 inch, WiFi+LTE)
iPad6,7 : iPad Pro (12.9 inch, WiFi)
iPad6,8 : iPad Pro (12.9 inch, WiFi+LTE)
iPad6,11 : iPad (2017)
iPad6,12 : iPad (2017)
iPad7,1 : iPad Pro 2nd Gen (WiFi)
iPad7,2 : iPad Pro 2nd Gen (WiFi+Cellular)
iPad7,3 : iPad Pro 10.5-inch 2nd Gen
iPad7,4 : iPad Pro 10.5-inch 2nd Gen
iPad7,5 : iPad 6th Gen (WiFi)
iPad7,6 : iPad 6th Gen (WiFi+Cellular)
iPad7,11 : iPad 7th Gen 10.2-inch (WiFi)
iPad7,12 : iPad 7th Gen 10.2-inch (WiFi+Cellular)
iPad8,1 : iPad Pro 11 inch 3rd Gen (WiFi)
iPad8,2 : iPad Pro 11 inch 3rd Gen (1TB, WiFi)
iPad8,3 : iPad Pro 11 inch 3rd Gen (WiFi+Cellular)
iPad8,4 : iPad Pro 11 inch 3rd Gen (1TB, WiFi+Cellular)
iPad8,5 : iPad Pro 12.9 inch 3rd Gen (WiFi)
iPad8,6 : iPad Pro 12.9 inch 3rd Gen (1TB, WiFi)
iPad8,7 : iPad Pro 12.9 inch 3rd Gen (WiFi+Cellular)
iPad8,8 : iPad Pro 12.9 inch 3rd Gen (1TB, WiFi+Cellular)
iPad8,9 : iPad Pro 11 inch 4th Gen (WiFi)
iPad8,10 : iPad Pro 11 inch 4th Gen (WiFi+Cellular)
iPad8,11 : iPad Pro 12.9 inch 4th Gen (WiFi)
iPad8,12 : iPad Pro 12.9 inch 4th Gen (WiFi+Cellular)
iPad11,1 : iPad mini 5th Gen (WiFi)
iPad11,2 : iPad mini 5th Gen
iPad11,3 : iPad Air 3rd Gen (WiFi)
iPad11,4 : iPad Air 3rd Gen
iPad11,6 : iPad 8th Gen (WiFi)
iPad11,7 : iPad 8th Gen (WiFi+Cellular)
iPad12,1 : iPad 9th Gen (WiFi)
iPad12,2 : iPad 9th Gen (WiFi+Cellular)
iPad14,1 : iPad mini 6th Gen (WiFi)
iPad14,2 : iPad mini 6th Gen (WiFi+Cellular)
iPad13,1 : iPad Air 4th Gen (WiFi)
iPad13,2 : iPad Air 4th Gen (WiFi+Cellular)
iPad13,4 : iPad Pro 11 inch 5th Gen
iPad13,5 : iPad Pro 11 inch 5th Gen
iPad13,6 : iPad Pro 11 inch 5th Gen
iPad13,7 : iPad Pro 11 inch 5th Gen
iPad13,8 : iPad Pro 12.9 inch 5th Gen
iPad13,9 : iPad Pro 12.9 inch 5th Gen
iPad13,10 : iPad Pro 12.9 inch 5th Gen
iPad13,11 : iPad Pro 12.9 inch 5th Gen
iPad13,16 : iPad Air 5th Gen (WiFi)
iPad13,17 : iPad Air 5th Gen (WiFi+Cellular)
iPad13,18 : iPad 10th Gen
iPad13,19 : iPad 10th Gen
iPad14,3 : iPad Pro 11 inch 4th Gen
iPad14,4 : iPad Pro 11 inch 4th Gen
iPad14,5 : iPad Pro 12.9 inch 6th Gen
iPad14,6 : iPad Pro 12.9 inch 6th Gen

Watch1,1 : Apple Watch 38mm case
Watch1,2 : Apple Watch 42mm case
Watch2,6 : Apple Watch Series 1 38mm case
Watch2,7 : Apple Watch Series 1 42mm case
Watch2,3 : Apple Watch Series 2 38mm case
Watch2,4 : Apple Watch Series 2 42mm case
Watch3,1 : Apple Watch Series 3 38mm case (GPS+Cellular)
Watch3,2 : Apple Watch Series 3 42mm case (GPS+Cellular)
Watch3,3 : Apple Watch Series 3 38mm case (GPS)
Watch3,4 : Apple Watch Series 3 42mm case (GPS)
Watch4,1 : Apple Watch Series 4 40mm case (GPS)
Watch4,2 : Apple Watch Series 4 44mm case (GPS)
Watch4,3 : Apple Watch Series 4 40mm case (GPS+Cellular)
Watch4,4 : Apple Watch Series 4 44mm case (GPS+Cellular)
Watch5,1 : Apple Watch Series 5 40mm case (GPS)
Watch5,2 : Apple Watch Series 5 44mm case (GPS)
Watch5,3 : Apple Watch Series 5 40mm case (GPS+Cellular)
Watch5,4 : Apple Watch Series 5 44mm case (GPS+Cellular)
Watch5,9 : Apple Watch SE 40mm case (GPS)
Watch5,10 : Apple Watch SE 44mm case (GPS)
Watch5,11 : Apple Watch SE 40mm case (GPS+Cellular)
Watch5,12 : Apple Watch SE 44mm case (GPS+Cellular)
Watch6,1 : Apple Watch Series 6 40mm case (GPS)
Watch6,2 : Apple Watch Series 6 44mm case (GPS)
Watch6,3 : Apple Watch Series 6 40mm case (GPS+Cellular)
Watch6,4 : Apple Watch Series 6 44mm case (GPS+Cellular)
Watch6,6 : Apple Watch Series 7 41mm case (GPS)
Watch6,7 : Apple Watch Series 7 45mm case (GPS)
Watch6,8 : Apple Watch Series 7 41mm case (GPS+Cellular)
Watch6,9 : Apple Watch Series 7 45mm case (GPS+Cellular)
Watch6,10 : Apple Watch SE 40mm case (GPS)
Watch6,11 : Apple Watch SE 44mm case (GPS)
Watch6,12 : Apple Watch SE 40mm case (GPS+Cellular)
Watch6,13 : Apple Watch SE 44mm case (GPS+Cellular)
Watch6,14 : Apple Watch Series 8 41mm case (GPS)
Watch6,15 : Apple Watch Series 8 45mm case (GPS)
Watch6,16 : Apple Watch Series 8 41mm case (GPS+Cellular)
Watch6,17 : Apple Watch Series 8 45mm case (GPS+Cellular)
Watch6,18 : Apple Watch Ultra
Watch7,1 : Apple Watch Series 9 41mm case (GPS)
Watch7,2 : Apple Watch Series 9 45mm case (GPS)
Watch7,3 : Apple Watch Series 9 41mm case (GPS+Cellular)
Watch7,4 : Apple Watch Series 9 45mm case (GPS+Cellular)
Watch7,5 : Apple Watch Ultra 2
上一篇下一篇

猜你喜欢

热点阅读