├── .swiftpm
└── xcode
│ ├── package.xcworkspace
│ └── contents.xcworkspacedata
│ └── xcshareddata
│ └── xcschemes
│ └── YMTGetDeviceName.xcscheme
├── YMTGetDeviceName.xcodeproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
├── xcshareddata
│ └── xcschemes
│ │ └── YMTGetDeviceName.xcscheme
└── project.pbxproj
├── Package.swift
├── Resource
└── Info.plist
├── README.md
├── LICENSE
├── .gitignore
├── Tests
└── YMTGetDeviceNameTests
│ └── YMTGetDeviceNameTests.swift
└── Sources
└── YMTGetDeviceName
└── YMTGetDeviceName.swift
/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/YMTGetDeviceName.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/YMTGetDeviceName.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Package.swift:
--------------------------------------------------------------------------------
1 | // swift-tools-version:5.5
2 | // The swift-tools-version declares the minimum version of Swift required to build this package.
3 |
4 | import PackageDescription
5 |
6 | let package = Package(
7 | name: "YMTGetDeviceName",
8 | products: [
9 | .library(
10 | name: "YMTGetDeviceName",
11 | targets: ["YMTGetDeviceName"]),
12 | ],
13 | targets: [
14 | .target(
15 | name: "YMTGetDeviceName",
16 | dependencies: []),
17 | .testTarget(
18 | name: "YMTGetDeviceNameTests",
19 | dependencies: ["YMTGetDeviceName"]),
20 | ]
21 | )
22 |
--------------------------------------------------------------------------------
/Resource/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | $(MARKETING_VERSION)
19 | CFBundleVersion
20 | $(CURRENT_PROJECT_VERSION)
21 | NSPrincipalClass
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # YMTGetDeviceName
2 | This framework is get device name from model number.
3 |
4 | ## Description
5 | Standard UIDevice can only distinguish iPhone or iPad.
6 | This framework is get device name from model number.
7 |
8 | ## Installation
9 | ### Use Swift Package Manager
10 |
11 | - File > Swift Packages > Add Package Dependency
12 | - Add https://github.com/MasamiYamate/YMTGetDeviceName
13 | - Select "Up to Next Major" with "5.8.0"
14 |
15 | ### Use Carthage
16 |
17 | Add to Cartfile
18 |
19 | ```
20 | github "MasamiYamate/YMTGetDeviceName" ~> 5.8.0
21 | ```
22 |
23 | Execute the following command
24 |
25 | ```
26 | carthage update --platform iOS --use-xcframeworks
27 | ```
28 |
29 | ## How to use
30 | ### Import
31 | ```ViewController.swift
32 | import YMTGetDeviceName
33 | ```
34 |
35 | ### Get device name
36 | ```ViewController.swift
37 | print(YMTGetDeviceName.getDeviceName())
38 | ```
39 |
40 | ## Q&A
41 | ### What is the range of supported devices?
42 | Supports iOS devices up to 2024/09/18 (JST)
43 |
44 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Masami Yamate
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 |
3 | # Xcode
4 | #
5 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
6 |
7 | ## User settings
8 | xcuserdata/
9 | !.xcodeproj/xcshareddata/xcschemes
10 |
11 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
12 | *.xcscmblueprint
13 | *.xccheckout
14 |
15 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
16 | build/
17 | DerivedData/
18 | *.moved-aside
19 | *.pbxuser
20 | !default.pbxuser
21 | *.mode1v3
22 | !default.mode1v3
23 | *.mode2v3
24 | !default.mode2v3
25 | *.perspectivev3
26 | !default.perspectivev3
27 |
28 | ## Obj-C/Swift specific
29 | *.hmap
30 |
31 | ## App packaging
32 | *.ipa
33 | *.dSYM.zip
34 | *.dSYM
35 |
36 | ## Playgrounds
37 | timeline.xctimeline
38 | playground.xcworkspace
39 |
40 | # Swift Package Manager
41 | #
42 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
43 | # Packages/
44 | # Package.pins
45 | # Package.resolved
46 | # *.xcodeproj
47 | #
48 | # Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
49 | # hence it is not needed unless you have added a package configuration file to your project
50 | # .swiftpm
51 |
52 | .build/
53 |
54 | # CocoaPods
55 | #
56 | # We recommend against adding the Pods directory to your .gitignore. However
57 | # you should judge for yourself, the pros and cons are mentioned at:
58 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
59 | #
60 | # Pods/
61 | #
62 | # Add this line if you want to avoid checking in source code from the Xcode workspace
63 | # *.xcworkspace
64 |
65 | # Carthage
66 | #
67 | # Add this line if you want to avoid checking in source code from Carthage dependencies.
68 | # Carthage/Checkouts
69 |
70 | Carthage/Build/
71 |
72 | # Accio dependency management
73 | Dependencies/
74 | .accio/
75 |
76 | # fastlane
77 | #
78 | # It is recommended to not store the screenshots in the git repo.
79 | # Instead, use fastlane to re-generate the screenshots whenever they are needed.
80 | # For more information about the recommended setup visit:
81 | # https://docs.fastlane.tools/best-practices/source-control/#source-control
82 |
83 | fastlane/report.xml
84 | fastlane/Preview.html
85 | fastlane/screenshots/**/*.png
86 | fastlane/test_output
87 |
88 | # Code Injection
89 | #
90 | # After new code Injection tools there's a generated folder /iOSInjectionProject
91 | # https://github.com/johnno1962/injectionforxcode
92 |
93 | iOSInjectionProject/
94 |
--------------------------------------------------------------------------------
/YMTGetDeviceName.xcodeproj/xcshareddata/xcschemes/YMTGetDeviceName.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
43 |
44 |
50 |
51 |
57 |
58 |
59 |
60 |
62 |
63 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/.swiftpm/xcode/xcshareddata/xcschemes/YMTGetDeviceName.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
31 |
32 |
34 |
40 |
41 |
42 |
43 |
44 |
54 |
55 |
61 |
62 |
64 |
65 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/Tests/YMTGetDeviceNameTests/YMTGetDeviceNameTests.swift:
--------------------------------------------------------------------------------
1 | import XCTest
2 | @testable import YMTGetDeviceName
3 |
4 | final class YMTGetDeviceNameTests: XCTestCase {
5 |
6 | // MARK: - iPhone Tests
7 |
8 | func testIPhone17() {
9 | XCTAssertEqual(YMTGetDeviceName.DeviceCode.iPhone18_3.deviceName(), "iPhone 17")
10 | }
11 |
12 | func testIPhone17Pro() {
13 | XCTAssertEqual(YMTGetDeviceName.DeviceCode.iPhone18_1.deviceName(), "iPhone 17 Pro")
14 | }
15 |
16 | func testIPhone17ProMax() {
17 | XCTAssertEqual(YMTGetDeviceName.DeviceCode.iPhone18_2.deviceName(), "iPhone 17 Pro Max")
18 | }
19 |
20 | func testIPhone17Air() {
21 | XCTAssertEqual(YMTGetDeviceName.DeviceCode.iPhone18_4.deviceName(), "iPhone 17 Air")
22 | }
23 |
24 | func testIPhone16e() {
25 | XCTAssertEqual(YMTGetDeviceName.DeviceCode.iPhone17_5.deviceName(), "iPhone 16e")
26 | }
27 |
28 | func testIPhone16() {
29 | XCTAssertEqual(YMTGetDeviceName.DeviceCode.iPhone17_3.deviceName(), "iPhone 16")
30 | }
31 |
32 | func testIPhone16Plus() {
33 | XCTAssertEqual(YMTGetDeviceName.DeviceCode.iPhone17_4.deviceName(), "iPhone 16 Plus")
34 | }
35 |
36 | func testIPhone16Pro() {
37 | XCTAssertEqual(YMTGetDeviceName.DeviceCode.iPhone17_1.deviceName(), "iPhone 16 Pro")
38 | }
39 |
40 | func testIPhone16ProMax() {
41 | XCTAssertEqual(YMTGetDeviceName.DeviceCode.iPhone17_2.deviceName(), "iPhone 16 Pro Max")
42 | }
43 |
44 | // MARK: - iPad mini Tests
45 |
46 | func testIPadMini7WiFi() {
47 | XCTAssertEqual(YMTGetDeviceName.DeviceCode.iPad16_1.deviceName(), "iPad mini 7th Generation WiFi")
48 | }
49 |
50 | func testIPadMini7Cellular() {
51 | XCTAssertEqual(YMTGetDeviceName.DeviceCode.iPad16_2.deviceName(), "iPad mini 7th Generation Cellular")
52 | }
53 |
54 | // MARK: - iPad Air M3 Tests
55 |
56 | func testIPadAir11InchM3WiFi() {
57 | XCTAssertEqual(YMTGetDeviceName.DeviceCode.iPad15_3.deviceName(), "iPad Air 11 inch M3")
58 | }
59 |
60 | func testIPadAir11InchM3Cellular() {
61 | XCTAssertEqual(YMTGetDeviceName.DeviceCode.iPad15_4.deviceName(), "iPad Air 11 inch M3")
62 | }
63 |
64 | func testIPadAir13InchM3WiFi() {
65 | XCTAssertEqual(YMTGetDeviceName.DeviceCode.iPad15_5.deviceName(), "iPad Air 13 inch M3")
66 | }
67 |
68 | func testIPadAir13InchM3Cellular() {
69 | XCTAssertEqual(YMTGetDeviceName.DeviceCode.iPad15_6.deviceName(), "iPad Air 13 inch M3")
70 | }
71 |
72 | // MARK: - iPad 11th Generation Tests
73 |
74 | func testIPad11thGenWiFi() {
75 | XCTAssertEqual(YMTGetDeviceName.DeviceCode.iPad15_7.deviceName(), "iPad 11th Generation WiFi")
76 | }
77 |
78 | func testIPad11thGenCellular() {
79 | XCTAssertEqual(YMTGetDeviceName.DeviceCode.iPad15_8.deviceName(), "iPad 11th Generation Cellular")
80 | }
81 |
82 | // MARK: - iPad Pro M4 Tests
83 |
84 | func testIPadPro11InchM4() {
85 | XCTAssertEqual(YMTGetDeviceName.DeviceCode.iPad16_3.deviceName(), "iPad Pro 11 inch M4")
86 | XCTAssertEqual(YMTGetDeviceName.DeviceCode.iPad16_4.deviceName(), "iPad Pro 11 inch M4")
87 | }
88 |
89 | func testIPadPro13InchM4() {
90 | XCTAssertEqual(YMTGetDeviceName.DeviceCode.iPad16_5.deviceName(), "iPad Pro 13 inch M4")
91 | XCTAssertEqual(YMTGetDeviceName.DeviceCode.iPad16_6.deviceName(), "iPad Pro 13 inch M4")
92 | }
93 |
94 | // MARK: - Simulator Tests
95 |
96 | func testSimulator() {
97 | XCTAssertEqual(YMTGetDeviceName.DeviceCode.i386.deviceName(), "Simulator")
98 | XCTAssertEqual(YMTGetDeviceName.DeviceCode.x86_64.deviceName(), "Simulator")
99 | XCTAssertEqual(YMTGetDeviceName.DeviceCode.arm64.deviceName(), "Simulator")
100 | }
101 |
102 | // MARK: - Device Code Raw Value Tests
103 |
104 | func testDeviceCodeRawValues() {
105 | XCTAssertEqual(YMTGetDeviceName.DeviceCode.iPhone18_1.rawValue, "iPhone18,1")
106 | XCTAssertEqual(YMTGetDeviceName.DeviceCode.iPhone18_2.rawValue, "iPhone18,2")
107 | XCTAssertEqual(YMTGetDeviceName.DeviceCode.iPhone18_3.rawValue, "iPhone18,3")
108 | XCTAssertEqual(YMTGetDeviceName.DeviceCode.iPhone18_4.rawValue, "iPhone18,4")
109 | XCTAssertEqual(YMTGetDeviceName.DeviceCode.iPad16_1.rawValue, "iPad16,1")
110 | XCTAssertEqual(YMTGetDeviceName.DeviceCode.iPad16_2.rawValue, "iPad16,2")
111 | XCTAssertEqual(YMTGetDeviceName.DeviceCode.iPad15_3.rawValue, "iPad15,3")
112 | XCTAssertEqual(YMTGetDeviceName.DeviceCode.iPad15_4.rawValue, "iPad15,4")
113 | XCTAssertEqual(YMTGetDeviceName.DeviceCode.iPad15_5.rawValue, "iPad15,5")
114 | XCTAssertEqual(YMTGetDeviceName.DeviceCode.iPad15_6.rawValue, "iPad15,6")
115 | XCTAssertEqual(YMTGetDeviceName.DeviceCode.iPad15_7.rawValue, "iPad15,7")
116 | XCTAssertEqual(YMTGetDeviceName.DeviceCode.iPad15_8.rawValue, "iPad15,8")
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/YMTGetDeviceName.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 50;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 944A88742873567500BE6B5A /* YMTGetDeviceName.swift in Sources */ = {isa = PBXBuildFile; fileRef = 944A88732873567500BE6B5A /* YMTGetDeviceName.swift */; };
11 | 944A88792873594F00BE6B5A /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 944A88782873594F00BE6B5A /* README.md */; };
12 | 944A887B2873595500BE6B5A /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = 944A887A2873595500BE6B5A /* LICENSE */; };
13 | /* End PBXBuildFile section */
14 |
15 | /* Begin PBXFileReference section */
16 | 944A88732873567500BE6B5A /* YMTGetDeviceName.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = YMTGetDeviceName.swift; path = Sources/YMTGetDeviceName/YMTGetDeviceName.swift; sourceTree = ""; };
17 | 944A88782873594F00BE6B5A /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; };
18 | 944A887A2873595500BE6B5A /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = ""; };
19 | 948CF3C427D39F34001C91E7 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
20 | D0B0413E2151ECEB001EB53D /* YMTGetDeviceName.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = YMTGetDeviceName.framework; sourceTree = BUILT_PRODUCTS_DIR; };
21 | /* End PBXFileReference section */
22 |
23 | /* Begin PBXFrameworksBuildPhase section */
24 | D0B0413A2151ECEB001EB53D /* Frameworks */ = {
25 | isa = PBXFrameworksBuildPhase;
26 | buildActionMask = 2147483647;
27 | files = (
28 | );
29 | runOnlyForDeploymentPostprocessing = 0;
30 | };
31 | /* End PBXFrameworksBuildPhase section */
32 |
33 | /* Begin PBXGroup section */
34 | 948CF3C227D39F34001C91E7 /* Resource */ = {
35 | isa = PBXGroup;
36 | children = (
37 | 948CF3C427D39F34001C91E7 /* Info.plist */,
38 | );
39 | path = Resource;
40 | sourceTree = "";
41 | };
42 | 94FD672F27D3A34D0096FE18 /* Frameworks */ = {
43 | isa = PBXGroup;
44 | children = (
45 | );
46 | name = Frameworks;
47 | sourceTree = "";
48 | };
49 | D0B041342151ECEB001EB53D = {
50 | isa = PBXGroup;
51 | children = (
52 | 944A887A2873595500BE6B5A /* LICENSE */,
53 | 944A88782873594F00BE6B5A /* README.md */,
54 | 944A88732873567500BE6B5A /* YMTGetDeviceName.swift */,
55 | 948CF3C227D39F34001C91E7 /* Resource */,
56 | D0B0413F2151ECEB001EB53D /* Products */,
57 | 94FD672F27D3A34D0096FE18 /* Frameworks */,
58 | );
59 | sourceTree = "";
60 | };
61 | D0B0413F2151ECEB001EB53D /* Products */ = {
62 | isa = PBXGroup;
63 | children = (
64 | D0B0413E2151ECEB001EB53D /* YMTGetDeviceName.framework */,
65 | );
66 | name = Products;
67 | sourceTree = "";
68 | };
69 | /* End PBXGroup section */
70 |
71 | /* Begin PBXHeadersBuildPhase section */
72 | D0B0413B2151ECEB001EB53D /* Headers */ = {
73 | isa = PBXHeadersBuildPhase;
74 | buildActionMask = 2147483647;
75 | files = (
76 | );
77 | runOnlyForDeploymentPostprocessing = 0;
78 | };
79 | /* End PBXHeadersBuildPhase section */
80 |
81 | /* Begin PBXNativeTarget section */
82 | D0B0413D2151ECEB001EB53D /* YMTGetDeviceName */ = {
83 | isa = PBXNativeTarget;
84 | buildConfigurationList = D0B041462151ECEB001EB53D /* Build configuration list for PBXNativeTarget "YMTGetDeviceName" */;
85 | buildPhases = (
86 | D0B041392151ECEB001EB53D /* Sources */,
87 | D0B0413A2151ECEB001EB53D /* Frameworks */,
88 | D0B0413B2151ECEB001EB53D /* Headers */,
89 | D0B0413C2151ECEB001EB53D /* Resources */,
90 | );
91 | buildRules = (
92 | );
93 | dependencies = (
94 | );
95 | name = YMTGetDeviceName;
96 | packageProductDependencies = (
97 | );
98 | productName = YMTGetDeviceName;
99 | productReference = D0B0413E2151ECEB001EB53D /* YMTGetDeviceName.framework */;
100 | productType = "com.apple.product-type.framework";
101 | };
102 | /* End PBXNativeTarget section */
103 |
104 | /* Begin PBXProject section */
105 | D0B041352151ECEB001EB53D /* Project object */ = {
106 | isa = PBXProject;
107 | attributes = {
108 | LastUpgradeCheck = 1210;
109 | ORGANIZATIONNAME = MasamiYamate;
110 | TargetAttributes = {
111 | D0B0413D2151ECEB001EB53D = {
112 | CreatedOnToolsVersion = 9.4.1;
113 | LastSwiftMigration = 1340;
114 | };
115 | };
116 | };
117 | buildConfigurationList = D0B041382151ECEB001EB53D /* Build configuration list for PBXProject "YMTGetDeviceName" */;
118 | compatibilityVersion = "Xcode 9.3";
119 | developmentRegion = en;
120 | hasScannedForEncodings = 0;
121 | knownRegions = (
122 | en,
123 | Base,
124 | );
125 | mainGroup = D0B041342151ECEB001EB53D;
126 | productRefGroup = D0B0413F2151ECEB001EB53D /* Products */;
127 | projectDirPath = "";
128 | projectRoot = "";
129 | targets = (
130 | D0B0413D2151ECEB001EB53D /* YMTGetDeviceName */,
131 | );
132 | };
133 | /* End PBXProject section */
134 |
135 | /* Begin PBXResourcesBuildPhase section */
136 | D0B0413C2151ECEB001EB53D /* Resources */ = {
137 | isa = PBXResourcesBuildPhase;
138 | buildActionMask = 2147483647;
139 | files = (
140 | 944A887B2873595500BE6B5A /* LICENSE in Resources */,
141 | 944A88792873594F00BE6B5A /* README.md in Resources */,
142 | );
143 | runOnlyForDeploymentPostprocessing = 0;
144 | };
145 | /* End PBXResourcesBuildPhase section */
146 |
147 | /* Begin PBXSourcesBuildPhase section */
148 | D0B041392151ECEB001EB53D /* Sources */ = {
149 | isa = PBXSourcesBuildPhase;
150 | buildActionMask = 2147483647;
151 | files = (
152 | 944A88742873567500BE6B5A /* YMTGetDeviceName.swift in Sources */,
153 | );
154 | runOnlyForDeploymentPostprocessing = 0;
155 | };
156 | /* End PBXSourcesBuildPhase section */
157 |
158 | /* Begin XCBuildConfiguration section */
159 | D0B041442151ECEB001EB53D /* Debug */ = {
160 | isa = XCBuildConfiguration;
161 | buildSettings = {
162 | ALWAYS_SEARCH_USER_PATHS = NO;
163 | CLANG_ANALYZER_NONNULL = YES;
164 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
165 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
166 | CLANG_CXX_LIBRARY = "libc++";
167 | CLANG_ENABLE_MODULES = YES;
168 | CLANG_ENABLE_OBJC_ARC = YES;
169 | CLANG_ENABLE_OBJC_WEAK = YES;
170 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
171 | CLANG_WARN_BOOL_CONVERSION = YES;
172 | CLANG_WARN_COMMA = YES;
173 | CLANG_WARN_CONSTANT_CONVERSION = YES;
174 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
175 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
176 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
177 | CLANG_WARN_EMPTY_BODY = YES;
178 | CLANG_WARN_ENUM_CONVERSION = YES;
179 | CLANG_WARN_INFINITE_RECURSION = YES;
180 | CLANG_WARN_INT_CONVERSION = YES;
181 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
182 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
183 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
184 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
185 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
186 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
187 | CLANG_WARN_STRICT_PROTOTYPES = YES;
188 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
189 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
190 | CLANG_WARN_UNREACHABLE_CODE = YES;
191 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
192 | CODE_SIGN_IDENTITY = "iPhone Developer";
193 | COPY_PHASE_STRIP = NO;
194 | CURRENT_PROJECT_VERSION = 1;
195 | DEBUG_INFORMATION_FORMAT = dwarf;
196 | ENABLE_STRICT_OBJC_MSGSEND = YES;
197 | ENABLE_TESTABILITY = YES;
198 | GCC_C_LANGUAGE_STANDARD = gnu11;
199 | GCC_DYNAMIC_NO_PIC = NO;
200 | GCC_NO_COMMON_BLOCKS = YES;
201 | GCC_OPTIMIZATION_LEVEL = 0;
202 | GCC_PREPROCESSOR_DEFINITIONS = (
203 | "DEBUG=1",
204 | "$(inherited)",
205 | );
206 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
207 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
208 | GCC_WARN_UNDECLARED_SELECTOR = YES;
209 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
210 | GCC_WARN_UNUSED_FUNCTION = YES;
211 | GCC_WARN_UNUSED_VARIABLE = YES;
212 | IPHONEOS_DEPLOYMENT_TARGET = 12.0;
213 | MTL_ENABLE_DEBUG_INFO = YES;
214 | ONLY_ACTIVE_ARCH = YES;
215 | SDKROOT = iphoneos;
216 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
217 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
218 | VERSIONING_SYSTEM = "apple-generic";
219 | VERSION_INFO_PREFIX = "";
220 | };
221 | name = Debug;
222 | };
223 | D0B041452151ECEB001EB53D /* Release */ = {
224 | isa = XCBuildConfiguration;
225 | buildSettings = {
226 | ALWAYS_SEARCH_USER_PATHS = NO;
227 | CLANG_ANALYZER_NONNULL = YES;
228 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
229 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
230 | CLANG_CXX_LIBRARY = "libc++";
231 | CLANG_ENABLE_MODULES = YES;
232 | CLANG_ENABLE_OBJC_ARC = YES;
233 | CLANG_ENABLE_OBJC_WEAK = YES;
234 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
235 | CLANG_WARN_BOOL_CONVERSION = YES;
236 | CLANG_WARN_COMMA = YES;
237 | CLANG_WARN_CONSTANT_CONVERSION = YES;
238 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
239 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
240 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
241 | CLANG_WARN_EMPTY_BODY = YES;
242 | CLANG_WARN_ENUM_CONVERSION = YES;
243 | CLANG_WARN_INFINITE_RECURSION = YES;
244 | CLANG_WARN_INT_CONVERSION = YES;
245 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
246 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
247 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
248 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
249 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
250 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
251 | CLANG_WARN_STRICT_PROTOTYPES = YES;
252 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
253 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
254 | CLANG_WARN_UNREACHABLE_CODE = YES;
255 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
256 | CODE_SIGN_IDENTITY = "iPhone Developer";
257 | COPY_PHASE_STRIP = NO;
258 | CURRENT_PROJECT_VERSION = 1;
259 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
260 | ENABLE_NS_ASSERTIONS = NO;
261 | ENABLE_STRICT_OBJC_MSGSEND = YES;
262 | GCC_C_LANGUAGE_STANDARD = gnu11;
263 | GCC_NO_COMMON_BLOCKS = YES;
264 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
265 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
266 | GCC_WARN_UNDECLARED_SELECTOR = YES;
267 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
268 | GCC_WARN_UNUSED_FUNCTION = YES;
269 | GCC_WARN_UNUSED_VARIABLE = YES;
270 | IPHONEOS_DEPLOYMENT_TARGET = 12.0;
271 | MTL_ENABLE_DEBUG_INFO = NO;
272 | SDKROOT = iphoneos;
273 | SWIFT_COMPILATION_MODE = wholemodule;
274 | SWIFT_OPTIMIZATION_LEVEL = "-O";
275 | VALIDATE_PRODUCT = YES;
276 | VERSIONING_SYSTEM = "apple-generic";
277 | VERSION_INFO_PREFIX = "";
278 | };
279 | name = Release;
280 | };
281 | D0B041472151ECEB001EB53D /* Debug */ = {
282 | isa = XCBuildConfiguration;
283 | buildSettings = {
284 | CLANG_ENABLE_MODULES = YES;
285 | CODE_SIGN_IDENTITY = "";
286 | CODE_SIGN_STYLE = Automatic;
287 | DEFINES_MODULE = YES;
288 | DYLIB_COMPATIBILITY_VERSION = 1;
289 | DYLIB_CURRENT_VERSION = 1;
290 | DYLIB_INSTALL_NAME_BASE = "@rpath";
291 | INFOPLIST_FILE = "$(SRCROOT)/Resource/Info.plist";
292 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
293 | IPHONEOS_DEPLOYMENT_TARGET = 12.0;
294 | LD_RUNPATH_SEARCH_PATHS = (
295 | "$(inherited)",
296 | "@executable_path/Frameworks",
297 | "@loader_path/Frameworks",
298 | );
299 | MARKETING_VERSION = 5.7.0;
300 | ONLY_ACTIVE_ARCH = NO;
301 | PRODUCT_BUNDLE_IDENTIFIER = net.yamatte.YMTGetDeviceName;
302 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
303 | SKIP_INSTALL = YES;
304 | SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
305 | SUPPORTS_MACCATALYST = NO;
306 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
307 | SWIFT_VERSION = 5.0;
308 | TARGETED_DEVICE_FAMILY = "1,2";
309 | };
310 | name = Debug;
311 | };
312 | D0B041482151ECEB001EB53D /* Release */ = {
313 | isa = XCBuildConfiguration;
314 | buildSettings = {
315 | CLANG_ENABLE_MODULES = YES;
316 | CODE_SIGN_IDENTITY = "";
317 | CODE_SIGN_STYLE = Automatic;
318 | DEFINES_MODULE = YES;
319 | DYLIB_COMPATIBILITY_VERSION = 1;
320 | DYLIB_CURRENT_VERSION = 1;
321 | DYLIB_INSTALL_NAME_BASE = "@rpath";
322 | INFOPLIST_FILE = "$(SRCROOT)/Resource/Info.plist";
323 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
324 | IPHONEOS_DEPLOYMENT_TARGET = 12.0;
325 | LD_RUNPATH_SEARCH_PATHS = (
326 | "$(inherited)",
327 | "@executable_path/Frameworks",
328 | "@loader_path/Frameworks",
329 | );
330 | MARKETING_VERSION = 5.7.0;
331 | ONLY_ACTIVE_ARCH = NO;
332 | PRODUCT_BUNDLE_IDENTIFIER = net.yamatte.YMTGetDeviceName;
333 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
334 | SKIP_INSTALL = YES;
335 | SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
336 | SUPPORTS_MACCATALYST = NO;
337 | SWIFT_VERSION = 5.0;
338 | TARGETED_DEVICE_FAMILY = "1,2";
339 | };
340 | name = Release;
341 | };
342 | /* End XCBuildConfiguration section */
343 |
344 | /* Begin XCConfigurationList section */
345 | D0B041382151ECEB001EB53D /* Build configuration list for PBXProject "YMTGetDeviceName" */ = {
346 | isa = XCConfigurationList;
347 | buildConfigurations = (
348 | D0B041442151ECEB001EB53D /* Debug */,
349 | D0B041452151ECEB001EB53D /* Release */,
350 | );
351 | defaultConfigurationIsVisible = 0;
352 | defaultConfigurationName = Release;
353 | };
354 | D0B041462151ECEB001EB53D /* Build configuration list for PBXNativeTarget "YMTGetDeviceName" */ = {
355 | isa = XCConfigurationList;
356 | buildConfigurations = (
357 | D0B041472151ECEB001EB53D /* Debug */,
358 | D0B041482151ECEB001EB53D /* Release */,
359 | );
360 | defaultConfigurationIsVisible = 0;
361 | defaultConfigurationName = Release;
362 | };
363 | /* End XCConfigurationList section */
364 | };
365 | rootObject = D0B041352151ECEB001EB53D /* Project object */;
366 | }
367 |
--------------------------------------------------------------------------------
/Sources/YMTGetDeviceName/YMTGetDeviceName.swift:
--------------------------------------------------------------------------------
1 | //
2 | // YMTGetDeviceName.swift
3 | // YMTGetDeviceName
4 | //
5 | // Created by MasamiYamate on 2018/09/19.
6 | // Copyright © 2018年 MasamiYamate. All rights reserved.
7 | //
8 | import Foundation
9 |
10 | public class YMTGetDeviceName {
11 |
12 | /// Device codes
13 | enum DeviceCode: String {
14 | // MARK: Simulator
15 | case i386
16 | case x86_64
17 | case arm64
18 | // MARK: iPod
19 | /// iPod Touch 1st Generation
20 | case iPod1_1 = "iPod1,1"
21 | /// iPod Touch 2nd Generation
22 | case iPod2_1 = "iPod2,1"
23 | /// iPod Touch 3rd Generation
24 | case iPod3_1 = "iPod3,1"
25 | /// iPod Touch 4th Generation
26 | case iPod4_1 = "iPod4,1"
27 | /// iPod Touch 5th Generation
28 | case iPod5_1 = "iPod5,1"
29 | /// iPod Touch 6th Generation
30 | case iPod7_1 = "iPod7,1"
31 | /// iPod Touch 7th Generation
32 | case iPod9_1 = "iPod9,1"
33 |
34 | // MARK: iPhone
35 | /// iPhone 2G
36 | case iPhone1_1 = "iPhone1,1"
37 | /// iPhone 3G
38 | case iPhone1_2 = "iPhone1,2"
39 | /// iPhone 3GS
40 | case iPhone2_1 = "iPhone2,1"
41 | /// iPhone 4 GSM
42 | case iPhone3_1 = "iPhone3,1"
43 | /// iPhone 4 GSM 2012
44 | case iPhone3_2 = "iPhone3,2"
45 | /// iPhone 4 CDMA For Verizon,Sprint
46 | case iPhone3_3 = "iPhone3,3"
47 | /// iPhone 4S
48 | case iPhone4_1 = "iPhone4,1"
49 | /// iPhone 5 GSM
50 | case iPhone5_1 = "iPhone5,1"
51 | /// iPhone 5 Global
52 | case iPhone5_2 = "iPhone5,2"
53 | /// iPhone 5c GSM
54 | case iPhone5_3 = "iPhone5,3"
55 | /// iPhone 5c Global
56 | case iPhone5_4 = "iPhone5,4"
57 | /// iPhone 5s GSM
58 | case iPhone6_1 = "iPhone6,1"
59 | /// iPhone 5s Global
60 | case iPhone6_2 = "iPhone6,2"
61 | /// iPhone 6 Plus
62 | case iPhone7_1 = "iPhone7,1"
63 | /// iPhone 6
64 | case iPhone7_2 = "iPhone7,2"
65 | /// iPhone 6S
66 | case iPhone8_1 = "iPhone8,1"
67 | /// iPhone 6S Plus
68 | case iPhone8_2 = "iPhone8,2"
69 | /// iPhone SE
70 | case iPhone8_4 = "iPhone8,4"
71 | /// iPhone 7 A1660,A1779,A1780
72 | case iPhone9_1 = "iPhone9,1"
73 | /// iPhone 7 A1778
74 | case iPhone9_3 = "iPhone9,3"
75 | /// iPhone 7 Plus A1661,A1785,A1786
76 | case iPhone9_2 = "iPhone9,2"
77 | /// iPhone 7 Plus A1784
78 | case iPhone9_4 = "iPhone9,4"
79 | /// iPhone 8 A1863,A1906,A1907
80 | case iPhone10_1 = "iPhone10,1"
81 | /// iPhone 8 A1905
82 | case iPhone10_4 = "iPhone10,4"
83 | /// iPhone 8 Plus A1864,A1898,A1899
84 | case iPhone10_2 = "iPhone10,2"
85 | /// iPhone 8 Plus A1897
86 | case iPhone10_5 = "iPhone10,5"
87 | /// iPhone X A1865,A1902
88 | case iPhone10_3 = "iPhone10,3"
89 | /// iPhone X A1901
90 | case iPhone10_6 = "iPhone10,6"
91 | /// iPhone XR A1984,A2105,A2106,A2108
92 | case iPhone11_8 = "iPhone11,8"
93 | /// iPhone XS A2097,A2098
94 | case iPhone11_2 = "iPhone11,2"
95 | /// iPhone XS Max A1921,A2103
96 | case iPhone11_4 = "iPhone11,4"
97 | /// iPhone XS Max A2104
98 | case iPhone11_6 = "iPhone11,6"
99 | /// iPhone 11
100 | case iPhone12_1 = "iPhone12,1"
101 | /// iPhone 11 Pro
102 | case iPhone12_3 = "iPhone12,3"
103 | /// iPhone 11 Pro Max
104 | case iPhone12_5 = "iPhone12,5"
105 | /// iPhone SE 2nd Generation
106 | case iPhone12_8 = "iPhone12,8"
107 | /// iPhone 12 mini
108 | case iPhone13_1 = "iPhone13,1"
109 | /// iPhone 12
110 | case iPhone13_2 = "iPhone13,2"
111 | /// iPhone 12 Pro
112 | case iPhone13_3 = "iPhone13,3"
113 | /// iPhone 12 Pro Max
114 | case iPhone13_4 = "iPhone13,4"
115 | /// iPhone 13 mini
116 | case iPhone14_4 = "iPhone14,4"
117 | /// iPhone 13
118 | case iPhone14_5 = "iPhone14,5"
119 | /// iPhone13 Pro
120 | case iPhone14_2 = "iPhone14,2"
121 | /// iPhone13 Pro Max
122 | case iPhone14_3 = "iPhone14,3"
123 | /// iPhone SE 3rd Generation
124 | case iPhone14_6 = "iPhone14,6"
125 | /// iPhone 14
126 | case iPhone14_7 = "iPhone14,7"
127 | /// iPhone 14 Plus
128 | case iPhone14_8 = "iPhone14,8"
129 | /// iPhone 14 Pro
130 | case iPhone15_2 = "iPhone15,2"
131 | /// iPhone 14 Pro Max
132 | case iPhone15_3 = "iPhone15,3"
133 | /// iPhone15
134 | case iPhone15_4 = "iPhone15,4"
135 | /// iPhone 15 Plus
136 | case iPhone15_5 = "iPhone15,5"
137 | /// iPhone 15 Pro
138 | case iPhone16_1 = "iPhone16,1"
139 | /// iPhone 15 Pro Max
140 | case iPhone16_2 = "iPhone16,2"
141 | /// iPhone 16 Pro
142 | case iPhone17_1 = "iPhone17,1"
143 | /// iPhone 16 Pro Max
144 | case iPhone17_2 = "iPhone17,2"
145 | /// iPhone 16
146 | case iPhone17_3 = "iPhone17,3"
147 | /// iPhone 16 Plus
148 | case iPhone17_4 = "iPhone17,4"
149 | /// iPhone 16e
150 | case iPhone17_5 = "iPhone17,5"
151 | /// iPhone 17
152 | case iPhone18_3 = "iPhone18,3"
153 | /// iPhone 17 Pro
154 | case iPhone18_1 = "iPhone18,1"
155 | /// iPhone 17 Pro Max
156 | case iPhone18_2 = "iPhone18,2"
157 | /// iPhone 17 Air
158 | case iPhone18_4 = "iPhone18,4"
159 |
160 | // MARK: iPad
161 | /// iPad 1
162 | case iPad1_1 = "iPad1,1"
163 | /// iPad 2
164 | case iPad2_1 = "iPad2,1"
165 | /// iPad2 GSM
166 | case iPad2_2 = "iPad2,2"
167 | /// iPad 2 CDMA (Cellular)
168 | case iPad2_3 = "iPad2,3"
169 | /// iPad 2 Mid2012
170 | case iPad2_4 = "iPad2,4"
171 | /// iPad Mini WiFi
172 | case iPad2_5 = "iPad2,5"
173 | /// iPad Mini GSM (Cellular)
174 | case iPad2_6 = "iPad2,6"
175 | /// iPad Mini Global (Cellular)
176 | case iPad2_7 = "iPad2,7"
177 | /// iPad 3 WiFi
178 | case iPad3_1 = "iPad3,1"
179 | /// iPad 3 CDMA (Cellular)
180 | case iPad3_2 = "iPad3,2"
181 | /// iPad 3 GSM (Cellular)
182 | case iPad3_3 = "iPad3,3"
183 | /// iPad 4 WiFi
184 | case iPad3_4 = "iPad3,4"
185 | /// iPad 4 GSM (Cellular)
186 | case iPad3_5 = "iPad3,5"
187 | /// iPad 4 Global (Cellular)
188 | case iPad3_6 = "iPad3,6"
189 | /// iPad Air WiFi
190 | case iPad4_1 = "iPad4,1"
191 | /// iPad Air Cellular
192 | case iPad4_2 = "iPad4,2"
193 | /// iPad Air ChinaModel
194 | case iPad4_3 = "iPad4,3"
195 | /// iPad mini 2 WiFi
196 | case iPad4_4 = "iPad4,4"
197 | /// iPad mini 2 Cellular
198 | case iPad4_5 = "iPad4,5"
199 | /// iPad mini 2 ChinaModel
200 | case iPad4_6 = "iPad4,6"
201 | /// iPad mini 3 WiFi
202 | case iPad4_7 = "iPad4,7"
203 | /// iPad mini 3 Cellular
204 | case iPad4_8 = "iPad4,8"
205 | /// iPad mini 3 ChinaModel
206 | case iPad4_9 = "iPad4,9"
207 | /// iPad Mini 4 WiFi
208 | case iPad5_1 = "iPad5,1"
209 | /// iPad Mini 4 Cellular
210 | case iPad5_2 = "iPad5,2"
211 | /// iPad Air 2 WiFi
212 | case iPad5_3 = "iPad5,3"
213 | /// iPad Air 2 Cellular
214 | case iPad5_4 = "iPad5,4"
215 | /// iPad Pro 9.7inch WiFi
216 | case iPad6_3 = "iPad6,3"
217 | /// iPad Pro 9.7inch Cellular
218 | case iPad6_4 = "iPad6,4"
219 | /// iPad Pro 12.9inch WiFi
220 | case iPad6_7 = "iPad6,7"
221 | /// iPad Pro 12.9inch Cellular
222 | case iPad6_8 = "iPad6,8"
223 | /// iPad 5th Generation WiFi
224 | case iPad6_11 = "iPad6,11"
225 | /// iPad 5th Generation Cellular
226 | case iPad6_12 = "iPad6,12"
227 | /// iPad Pro 12.9inch 2nd Generation WiFi
228 | case iPad7_1 = "iPad7,1"
229 | /// iPad Pro 12.9inch 2nd Generation Cellular
230 | case iPad7_2 = "iPad7,2"
231 | /// iPad Pro 10.5inch A1701 WiFi
232 | case iPad7_3 = "iPad7,3"
233 | /// iPad Pro 10.5inch A1709 Cellular
234 | case iPad7_4 = "iPad7,4"
235 | /// iPad 6th Generation WiFi
236 | case iPad7_5 = "iPad7,5"
237 | /// iPad 6th Generation Cellular
238 | case iPad7_6 = "iPad7,6"
239 | /// iPad 7th Generation WiFi
240 | case iPad7_11 = "iPad7,11"
241 | /// iPad 7th Generation Cellular
242 | case iPad7_12 = "iPad7,12"
243 | /// iPad Pro 11inch WiFi
244 | case iPad8_1 = "iPad8,1"
245 | /// iPad Pro 11inch WiFi
246 | case iPad8_2 = "iPad8,2"
247 | /// iPad Pro 11inch Cellular
248 | case iPad8_3 = "iPad8,3"
249 | /// iPad Pro 11inch Cellular
250 | case iPad8_4 = "iPad8,4"
251 | /// iPad Pro 12.9inch WiFi
252 | case iPad8_5 = "iPad8,5"
253 | /// iPad Pro 12.9inch WiFi
254 | case iPad8_6 = "iPad8,6"
255 | /// iPad Pro 12.9inch Cellular
256 | case iPad8_7 = "iPad8,7"
257 | /// iPad Pro 12.9inch Cellular
258 | case iPad8_8 = "iPad8,8"
259 | /// iPad Pro 11inch 2nd generation WiFi
260 | case iPad8_9 = "iPad8,9"
261 | /// iPad Pro 11inch 2nd generation Cellular
262 | case iPad8_10 = "iPad8,10"
263 | /// iPad Pro 12.9inch 4th generation WiFi
264 | case iPad8_11 = "iPad8,11"
265 | /// iPad Pro 12.9inch 4th generation Cellular
266 | case iPad8_12 = "iPad8,12"
267 | /// iPad mini 5th WiFi
268 | case iPad11_1 = "iPad11,1"
269 | /// iPad mini 5th Cellular
270 | case iPad11_2 = "iPad11,2"
271 | /// iPad Air 3rd generation WiFi
272 | case iPad11_3 = "iPad11,3"
273 | /// iPad Air 3rd generation Cellular
274 | case iPad11_4 = "iPad11,4"
275 | /// iPad 8th generation WiFi
276 | case iPad11_6 = "iPad11,6"
277 | /// iPad 8th generation Cellular
278 | case iPad11_7 = "iPad11,7"
279 | /// iPad Air 4th generation WiFi
280 | case iPad13_1 = "iPad13,1"
281 | /// iPad Air 4th generation Cellular
282 | case iPad13_2 = "iPad13,2"
283 | /// iPad Pro 11inch 3rd generation WiFi
284 | case iPad13_4 = "iPad13,4"
285 | /// iPad Pro 11inch 3rd generation WiFi
286 | case iPad13_5 = "iPad13,5"
287 | /// iPad Pro 11inch 3rd generation Cellular
288 | case iPad13_6 = "iPad13,6"
289 | /// iPad Pro 11inch 3rd generation Cellular
290 | case iPad13_7 = "iPad13,7"
291 | /// iPad Pro 12inch 5th generation WiFi
292 | case iPad13_8 = "iPad13,8"
293 | /// iPad Pro 12inch 5th generation WiFi
294 | case iPad13_9 = "iPad13,9"
295 | /// iPad Pro 12inch 5th generation Cellular
296 | case iPad13_10 = "iPad13,10"
297 | /// iPad Pro 12inch 5th generation Cellular
298 | case iPad13_11 = "iPad13,11"
299 | /// iPad mini 6th generation WiFi
300 | case iPad14_1 = "iPad14,1"
301 | /// iPad mini 6th generation Cellular
302 | case iPad14_2 = "iPad14,2"
303 | /// iPad 9th generation WiFi
304 | case iPad12_1 = "iPad12,1"
305 | /// iPad 9th generation Cellular
306 | case iPad12_2 = "iPad12,2"
307 | /// iPad Air 5th generation WiFi
308 | case iPad13_16 = "iPad13,16"
309 | /// iPad Air 5th generation Cellular
310 | case iPad13_17 = "iPad13,17"
311 | /// iPad 10th Gen
312 | case iPad13_18 = "iPad13,18"
313 | /// iPad 10th Gen
314 | case iPad13_19 = "iPad13,19"
315 | /// iPad Pro 11 inch 4th Gen
316 | case iPad14_3 = "iPad14,3"
317 | /// iPad Pro 11 inch 4th Gen
318 | case iPad14_4 = "iPad14,4"
319 | /// iPad Pro 12.9 inch 6th Gen
320 | case iPad14_5 = "iPad14,5"
321 | /// iPad Pro 12.9 inch 6th Gen
322 | case iPad14_6 = "iPad14,6"
323 | /// iPad Air 11inch M2 WiFi
324 | case iPad14_8 = "iPad14,8"
325 | /// iPad Air 11inch M2 Cellular
326 | case iPad14_9 = "iPad14,9"
327 | /// iPad Air 13inch M2 WiFi
328 | case iPad14_10 = "iPad14,10"
329 | /// iPad Air 13inch M2 Cellular
330 | case iPad14_11 = "iPad14,11"
331 | /// iPad Pro 11inch M4 WiFi
332 | case iPad16_3 = "iPad16,3"
333 | /// iPad Pro 11inch M4 Cellular
334 | case iPad16_4 = "iPad16,4"
335 | /// iPad Pro 13inch M4 WiFi
336 | case iPad16_5 = "iPad16,5"
337 | /// iPad Pro 13inch M4 Cellular
338 | case iPad16_6 = "iPad16,6"
339 | /// iPad mini 7th Generation WiFi
340 | case iPad16_1 = "iPad16,1"
341 | /// iPad mini 7th Generation Cellular
342 | case iPad16_2 = "iPad16,2"
343 | /// iPad Air 11inch M3 WiFi
344 | case iPad15_3 = "iPad15,3"
345 | /// iPad Air 11inch M3 Cellular
346 | case iPad15_4 = "iPad15,4"
347 | /// iPad Air 13inch M3 WiFi
348 | case iPad15_5 = "iPad15,5"
349 | /// iPad Air 13inch M3 Cellular
350 | case iPad15_6 = "iPad15,6"
351 | /// iPad 11th Generation WiFi
352 | case iPad15_7 = "iPad15,7"
353 | /// iPad 11th Generation Cellular
354 | case iPad15_8 = "iPad15,8"
355 |
356 | /// device name
357 | func deviceName() -> String {
358 | switch self {
359 | case .i386, .x86_64, .arm64:
360 | return "Simulator"
361 | case .iPod1_1:
362 | return "iPod Touch 1st Generation"
363 | case .iPod2_1:
364 | return "iPod Touch 2nd Generation"
365 | case .iPod3_1:
366 | return "iPod Touch 3rd Generation"
367 | case .iPod4_1:
368 | return "iPod Touch 4th Generation"
369 | case .iPod5_1:
370 | return "iPod Touch 5th Generation"
371 | case .iPod7_1:
372 | return "iPod Touch 6th Generation"
373 | case .iPod9_1:
374 | return "iPod Touch 7th Generation"
375 | case .iPhone1_1:
376 | return "iPhone 2G"
377 | case .iPhone1_2:
378 | return "iPhone 3G"
379 | case .iPhone2_1:
380 | return "iPhone 3GS"
381 | case .iPhone3_1, .iPhone3_2, .iPhone3_3:
382 | return "iPhone4"
383 | case .iPhone4_1:
384 | return "iPhone 4S"
385 | case .iPhone5_1, .iPhone5_2:
386 | return "iPhone 5"
387 | case .iPhone5_3, .iPhone5_4:
388 | return "iPhone 5c"
389 | case .iPhone6_1, .iPhone6_2:
390 | return "iPhone 5s"
391 | case .iPhone7_1:
392 | return "iPhone 6 Plus"
393 | case .iPhone7_2:
394 | return "iPhone 6"
395 | case .iPhone8_1:
396 | return "iPhone 6s"
397 | case .iPhone8_2:
398 | return "iPhone 6s Plus"
399 | case .iPhone8_4:
400 | return "iPhone SE 1st Generation"
401 | case .iPhone9_1, .iPhone9_3:
402 | return "iPhone 7"
403 | case .iPhone9_2, .iPhone9_4:
404 | return "iPhone 7 Plus"
405 | case .iPhone10_1, .iPhone10_4:
406 | return "iPhone 8"
407 | case .iPhone10_2, .iPhone10_5:
408 | return "iPhone 8 Plus"
409 | case .iPhone10_3, .iPhone10_6:
410 | return "iPhone X"
411 | case .iPhone11_8:
412 | return "iPhone XR"
413 | case .iPhone11_2:
414 | return "iPhone XS"
415 | case .iPhone11_4, .iPhone11_6:
416 | return "iPhone XS Max"
417 | case .iPhone12_1:
418 | return "iPhone 11"
419 | case .iPhone12_3:
420 | return "iPhone 11 Pro"
421 | case .iPhone12_5:
422 | return "iPhone 11 Pro Max"
423 | case .iPhone12_8:
424 | return "iPhone SE 2nd Generation"
425 | case .iPhone13_1:
426 | return "iPhone 12 mini"
427 | case .iPhone13_2:
428 | return "iPhone 12"
429 | case .iPhone13_3:
430 | return "iPhone 12 Pro"
431 | case .iPhone13_4:
432 | return "iPhone 12 Pro Max"
433 | case .iPhone14_4:
434 | return "iPhone 13 mini"
435 | case .iPhone14_5:
436 | return "iPhone 13"
437 | case .iPhone14_2:
438 | return "iPhone 13 Pro"
439 | case .iPhone14_3:
440 | return "iPhone 13 Pro Max"
441 | case .iPhone14_7:
442 | return "iPhone 14"
443 | case .iPhone14_8:
444 | return "iPhone 14 Plus"
445 | case .iPhone15_2:
446 | return "iPhone 14 Pro"
447 | case .iPhone15_3:
448 | return "iPhone 14 Pro Max"
449 | case .iPhone15_4:
450 | return "iPhone 15"
451 | case .iPhone15_5:
452 | return "iPhone 15 Plus"
453 | case .iPhone16_1:
454 | return "iPhone 15 Pro"
455 | case .iPhone16_2:
456 | return "iPhone 15 Pro Max"
457 | case .iPhone17_1:
458 | return "iPhone 16 Pro"
459 | case .iPhone17_2:
460 | return "iPhone 16 Pro Max"
461 | case .iPhone17_3:
462 | return "iPhone 16"
463 | case .iPhone17_4:
464 | return "iPhone 16 Plus"
465 | case .iPhone17_5:
466 | return "iPhone 16e"
467 | case .iPhone18_3:
468 | return "iPhone 17"
469 | case .iPhone18_1:
470 | return "iPhone 17 Pro"
471 | case .iPhone18_2:
472 | return "iPhone 17 Pro Max"
473 | case .iPhone18_4:
474 | return "iPhone 17 Air"
475 | case .iPad1_1:
476 | return "iPad 1"
477 | case .iPad2_1, .iPad2_4:
478 | return "iPad 2 WiFi"
479 | case .iPad2_2, .iPad2_3:
480 | return "iPad 2 Cellular"
481 | case .iPad2_5:
482 | return "iPad mini 1st Generation WiFi"
483 | case .iPad2_6, .iPad2_7:
484 | return "iPad mini 1st Generation Cellular"
485 | case .iPad3_1:
486 | return "iPad 3 WiFi"
487 | case .iPad3_2, .iPad3_3:
488 | return "iPad 3 Cellular"
489 | case .iPad3_4:
490 | return "iPad 4 WiFi"
491 | case .iPad3_5, .iPad3_6:
492 | return "iPad 4 Cellular"
493 | case .iPad4_1:
494 | return "iPad Air 1st Generation WiFi"
495 | case .iPad4_2, .iPad4_3:
496 | return "iPad Air 1st Generation Cellular"
497 | case .iPad4_4:
498 | return "iPad mini 2 WiFi"
499 | case .iPad4_5, .iPad4_6:
500 | return "iPad mini 2 Cellular"
501 | case .iPad4_7:
502 | return "iPad mini 3 WiFi"
503 | case .iPad4_8, .iPad4_9:
504 | return "iPad mini 3 Cellular"
505 | case .iPad5_1:
506 | return "iPad mini 4 WiFi"
507 | case .iPad5_2:
508 | return "iPad mini 4 Cellular"
509 | case .iPad5_3:
510 | return "iPad Air 2 WiFi"
511 | case .iPad5_4:
512 | return "iPad Air 2 Cellular"
513 | case .iPad6_3:
514 | return "iPad Pro 9.7inch WiFi"
515 | case .iPad6_4:
516 | return "iPad Pro 9.7inch Cellular"
517 | case .iPad6_7:
518 | return "iPad Pro 12.9inch WiFi"
519 | case .iPad6_8:
520 | return "iPad Pro 12.9inch WiFi"
521 | case .iPad6_11:
522 | return "iPad 5th Generation WiFi"
523 | case .iPad6_12:
524 | return "iPad 5th Generation Cellular"
525 | case .iPad7_1:
526 | return "iPad Pro 12.9inch 2nd Generation WiFi"
527 | case .iPad7_2:
528 | return "iPad Pro 12.9inch 2nd Generation Cellular"
529 | case .iPad7_3:
530 | return "iPad Pro 10.5inch WiFi"
531 | case .iPad7_4:
532 | return "iPad Pro 10.5inch Cellular"
533 | case .iPad7_5:
534 | return "iPad 6th Generation WiFi"
535 | case .iPad7_6:
536 | return "iPad 6th Generation Cellular"
537 | case .iPad7_11:
538 | return "iPad 7th Generation WiFi"
539 | case .iPad7_12:
540 | return "iPad 7th Generation Cellular"
541 | case .iPad8_1, .iPad8_2:
542 | return "iPad Pro 11inch WiFi"
543 | case .iPad8_3, .iPad8_4:
544 | return "iPad Pro 11inch Cellular"
545 | case .iPad8_5, .iPad8_6:
546 | return "iPad Pro 12.9inch 3rd Generation WiFi"
547 | case .iPad8_7, .iPad8_8:
548 | return "iPad Pro 12.9inch 3rd Generation Cellular"
549 | case .iPad8_9:
550 | return "iPad Pro 11inch 2nd Generation WiFi"
551 | case .iPad8_10:
552 | return "iPad Pro 11inch 2nd Generation Cellular"
553 | case .iPad8_11:
554 | return "iPad Pro 12.9inch 4th Generation WiFi"
555 | case .iPad8_12:
556 | return "iPad Pro 12.9inch 4th Generation Cellular"
557 | case .iPad11_1:
558 | return "iPad mini 5th Generation WiFi"
559 | case .iPad11_2:
560 | return "iPad mini 5th Generation Cellular"
561 | case .iPad11_3:
562 | return "iPad Air 3rd Generation WiFi"
563 | case .iPad11_4:
564 | return "iPad Air 3rd Generation Cellular"
565 | case .iPad11_6:
566 | return "iPad 8th Generation WiFi"
567 | case .iPad11_7:
568 | return "iPad 8th Generation Cellular"
569 | case .iPad13_1:
570 | return "iPad Air 4th Generation WiFi"
571 | case .iPad13_2:
572 | return "iPad Air 4th Generation Cellular"
573 | case .iPad13_4, .iPad13_5:
574 | return "iPad Pro 11inch 3rd Generation WiFi"
575 | case .iPad13_6, .iPad13_7:
576 | return "iPad Pro 11inch 3rd Generation Cellular"
577 | case .iPad13_8, .iPad13_9:
578 | return "iPad Pro 12.9inch 5th Generation WiFi"
579 | case .iPad13_10, .iPad13_11:
580 | return "iPad Pro 12.9inch 5th Generation Cellular"
581 | case .iPad14_1:
582 | return "iPad mini 6th Generation WiFi"
583 | case .iPad14_2:
584 | return "iPad mini 6th Generation Cellular"
585 | case .iPad12_1:
586 | return "iPad 9th generation WiFi"
587 | case .iPad12_2:
588 | return "iPad 9th generation Cellular"
589 | case .iPhone14_6:
590 | return "iPhone SE 3rd Generation"
591 | case .iPad13_16:
592 | return "iPad Air 5th Generation WiFi"
593 | case .iPad13_17:
594 | return "iPad Air 5th Generation Cellular"
595 | case .iPad13_18:
596 | return "iPad 10th Gen"
597 | case .iPad13_19:
598 | return "iPad 10th Gen"
599 | case .iPad14_3:
600 | return "iPad Pro 11 inch 4th Gen"
601 | case .iPad14_4:
602 | return "iPad Pro 11 inch 4th Gen"
603 | case .iPad14_5:
604 | return "iPad Pro 12.9 inch 6th Gen"
605 | case .iPad14_6:
606 | return "iPad Pro 12.9 inch 6th Gen"
607 | case .iPad14_8, .iPad14_9:
608 | return "iPad Air 11 inch M2"
609 | case .iPad14_10, .iPad14_11:
610 | return "iPad Air 13 inch M2"
611 | case .iPad16_3, .iPad16_4:
612 | return "iPad Pro 11 inch M4"
613 | case .iPad16_5, .iPad16_6:
614 | return "iPad Pro 13 inch M4"
615 | case .iPad16_1:
616 | return "iPad mini 7th Generation WiFi"
617 | case .iPad16_2:
618 | return "iPad mini 7th Generation Cellular"
619 | case .iPad15_3, .iPad15_4:
620 | return "iPad Air 11 inch M3"
621 | case .iPad15_5, .iPad15_6:
622 | return "iPad Air 13 inch M3"
623 | case .iPad15_7:
624 | return "iPad 11th Generation WiFi"
625 | case .iPad15_8:
626 | return "iPad 11th Generation Cellular"
627 | }
628 | }
629 | }
630 |
631 | /// Get device name from model number
632 | ///
633 | /// - Returns: Device name (iPhone X , iPhoneXS ... etc)
634 | public static func getDeviceName () -> String {
635 | var size: Int = 0
636 | sysctlbyname("hw.machine", nil, &size, nil, 0)
637 | var machine = [CChar](repeating: 0, count: Int(size))
638 | sysctlbyname("hw.machine", &machine, &size, nil, 0)
639 | let code: String = String(cString:machine)
640 |
641 | guard let deviceCode = DeviceCode(rawValue: code) else {
642 | return otherDeviceType(with: code)
643 | }
644 |
645 | return deviceCode.deviceName()
646 | }
647 |
648 | /// Return only unsupported model types
649 | /// - Parameter rawCode: device code
650 | /// - Returns: device type name
651 | private static func otherDeviceType(with rawCode: String) -> String {
652 | if rawCode.range(of: "iPod") != nil {
653 | return "iPod Touch (unknown)"
654 | } else if rawCode.range(of: "iPad") != nil {
655 | return "iPad (unknown)"
656 | } else if rawCode.range(of: "iPhone") != nil {
657 | return "iPhone (unknown)"
658 | } else {
659 | return "Unknown device"
660 | }
661 | }
662 |
663 | }
664 |
--------------------------------------------------------------------------------