├── .gitignore ├── Device macOS ├── Device macOS.h └── Info.plist ├── Device.podspec ├── Device.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcshareddata │ └── xcschemes │ ├── Device macOS.xcscheme │ └── Device.xcscheme ├── Device ├── Device.h └── Info.plist ├── Example macOS ├── AppDelegate.swift ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ └── Main.storyboard ├── Info.plist └── ViewController.swift ├── Example ├── AppDelegate.swift ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist └── ViewController.swift ├── LICENSE ├── Package.swift ├── README.md └── Source ├── Asset └── device.png ├── Size.swift ├── Type.swift ├── Version.swift ├── iOS └── Device.swift └── macOS └── DeviceMacOS.swift /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa 18 | *.xcuserstate 19 | 20 | # CocoaPods 21 | # 22 | # We recommend against adding the Pods directory to your .gitignore. However 23 | # you should judge for yourself, the pros and cons are mentioned at: 24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 25 | # 26 | # Pods/ 27 | 28 | # Carthage 29 | # 30 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 31 | # Carthage/Checkouts 32 | 33 | Carthage/Build 34 | .DS_Store 35 | .build 36 | -------------------------------------------------------------------------------- /Device macOS/Device macOS.h: -------------------------------------------------------------------------------- 1 | // 2 | // Device macOS.h 3 | // Device macOS 4 | // 5 | // Created by Tom Baranes on 16/08/16. 6 | // Copyright © 2016 Ekhoo. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for Device macOS. 12 | FOUNDATION_EXPORT double Device_macOSVersionNumber; 13 | 14 | //! Project version string for Device macOS. 15 | FOUNDATION_EXPORT const unsigned char Device_macOSVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /Device macOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSHumanReadableCopyright 24 | Copyright © 2016 Ekhoo. All rights reserved. 25 | NSPrincipalClass 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /Device.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "Device" 3 | s.version = "3.7.0" 4 | s.summary = "Light weight tool for detecting the current device and screen size written in swift." 5 | 6 | s.description = "Swift library for detecting the running device's model and screen size. With the newer  devices, developers have more work to do. This library simplifies their job by allowing them to get information about the running device and easily target the ones they want." 7 | 8 | s.homepage = "https://github.com/Ekhoo/Device" 9 | s.license = { :type => "MIT", :file => "LICENSE" } 10 | s.author = { "Lucas Ortis" => "me@lucas-ortis.com" } 11 | s.source = { :git => "https://github.com/Ekhoo/Device.git", :tag => s.version.to_s } 12 | 13 | s.ios.deployment_target = '11.0' 14 | s.osx.deployment_target = '10.13' 15 | 16 | s.requires_arc = true 17 | s.source_files = "Source/*.swift" 18 | s.ios.source_files = "Source/iOS/*.swift" 19 | s.osx.source_files = "Source/macOS/*.swift" 20 | 21 | s.swift_version = '5.0' 22 | end 23 | -------------------------------------------------------------------------------- /Device.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 001C446E1C3C08C000F6599D /* Device.h in Headers */ = {isa = PBXBuildFile; fileRef = 001C446D1C3C08C000F6599D /* Device.h */; settings = {ATTRIBUTES = (Public, ); }; }; 11 | 001C44801C3C08C000F6599D /* Device.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 001C44691C3C08C000F6599D /* Device.framework */; }; 12 | 001C44811C3C08C000F6599D /* Device.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 001C44691C3C08C000F6599D /* Device.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 13 | 006E76C41C3C09DE00656720 /* Version.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE11EF0F1BE4001A00816835 /* Version.swift */; }; 14 | 006E76C51C3C09DE00656720 /* Size.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE11EF111BE4002800816835 /* Size.swift */; }; 15 | 006E76C61C3C09DE00656720 /* Type.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8E8F0391C176DB7006B19D2 /* Type.swift */; }; 16 | BE11EF011BE3FD9200816835 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE11EEFC1BE3FD9200816835 /* AppDelegate.swift */; }; 17 | BE11EF021BE3FD9200816835 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BE11EEFD1BE3FD9200816835 /* Assets.xcassets */; }; 18 | BE11EF051BE3FD9200816835 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE11EF001BE3FD9200816835 /* ViewController.swift */; }; 19 | BE11EF0A1BE3FE9500816835 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BE11EF061BE3FE9500816835 /* LaunchScreen.storyboard */; }; 20 | BE11EF0B1BE3FE9500816835 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BE11EF081BE3FE9500816835 /* Main.storyboard */; }; 21 | E2C023AD1D6331010033AD25 /* Device macOS.h in Headers */ = {isa = PBXBuildFile; fileRef = E2C023AC1D6331010033AD25 /* Device macOS.h */; settings = {ATTRIBUTES = (Public, ); }; }; 22 | E2C023B21D6331220033AD25 /* Version.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE11EF0F1BE4001A00816835 /* Version.swift */; }; 23 | E2C023B31D6331220033AD25 /* Size.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE11EF111BE4002800816835 /* Size.swift */; }; 24 | E2C023B41D6331220033AD25 /* Type.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8E8F0391C176DB7006B19D2 /* Type.swift */; }; 25 | E2C023B71D6331A00033AD25 /* Device.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2C023B61D6331A00033AD25 /* Device.swift */; }; 26 | E2C023C21D6338BB0033AD25 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2C023C11D6338BB0033AD25 /* AppDelegate.swift */; }; 27 | E2C023C41D6338BB0033AD25 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2C023C31D6338BB0033AD25 /* ViewController.swift */; }; 28 | E2C023C61D6338BB0033AD25 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E2C023C51D6338BB0033AD25 /* Assets.xcassets */; }; 29 | E2C023C91D6338BB0033AD25 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E2C023C71D6338BB0033AD25 /* Main.storyboard */; }; 30 | E2C023CE1D6339580033AD25 /* Device.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E2C023AA1D6331010033AD25 /* Device.framework */; }; 31 | E2C023CF1D6339580033AD25 /* Device.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = E2C023AA1D6331010033AD25 /* Device.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 32 | E2DAC74A1D643D9F00E7A07B /* DeviceMacOS.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2DAC7491D643D9F00E7A07B /* DeviceMacOS.swift */; }; 33 | /* End PBXBuildFile section */ 34 | 35 | /* Begin PBXContainerItemProxy section */ 36 | 001C447E1C3C08C000F6599D /* PBXContainerItemProxy */ = { 37 | isa = PBXContainerItemProxy; 38 | containerPortal = BE11EEDF1BE3FC0300816835 /* Project object */; 39 | proxyType = 1; 40 | remoteGlobalIDString = 001C44681C3C08C000F6599D; 41 | remoteInfo = Device; 42 | }; 43 | E2C023D01D6339580033AD25 /* PBXContainerItemProxy */ = { 44 | isa = PBXContainerItemProxy; 45 | containerPortal = BE11EEDF1BE3FC0300816835 /* Project object */; 46 | proxyType = 1; 47 | remoteGlobalIDString = E2C023A91D6331010033AD25; 48 | remoteInfo = "Device macOS"; 49 | }; 50 | /* End PBXContainerItemProxy section */ 51 | 52 | /* Begin PBXCopyFilesBuildPhase section */ 53 | 001C44851C3C08C000F6599D /* Embed Frameworks */ = { 54 | isa = PBXCopyFilesBuildPhase; 55 | buildActionMask = 2147483647; 56 | dstPath = ""; 57 | dstSubfolderSpec = 10; 58 | files = ( 59 | 001C44811C3C08C000F6599D /* Device.framework in Embed Frameworks */, 60 | ); 61 | name = "Embed Frameworks"; 62 | runOnlyForDeploymentPostprocessing = 0; 63 | }; 64 | E2C023D21D6339580033AD25 /* Embed Frameworks */ = { 65 | isa = PBXCopyFilesBuildPhase; 66 | buildActionMask = 2147483647; 67 | dstPath = ""; 68 | dstSubfolderSpec = 10; 69 | files = ( 70 | E2C023CF1D6339580033AD25 /* Device.framework in Embed Frameworks */, 71 | ); 72 | name = "Embed Frameworks"; 73 | runOnlyForDeploymentPostprocessing = 0; 74 | }; 75 | /* End PBXCopyFilesBuildPhase section */ 76 | 77 | /* Begin PBXFileReference section */ 78 | 001C44691C3C08C000F6599D /* Device.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Device.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 79 | 001C446C1C3C08C000F6599D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 80 | 001C446D1C3C08C000F6599D /* Device.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Device.h; sourceTree = ""; }; 81 | BE11EEE71BE3FC0300816835 /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 82 | BE11EEFC1BE3FD9200816835 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = Example/AppDelegate.swift; sourceTree = SOURCE_ROOT; }; 83 | BE11EEFD1BE3FD9200816835 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Example/Assets.xcassets; sourceTree = SOURCE_ROOT; }; 84 | BE11EEFF1BE3FD9200816835 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Example/Info.plist; sourceTree = SOURCE_ROOT; }; 85 | BE11EF001BE3FD9200816835 /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ViewController.swift; path = Example/ViewController.swift; sourceTree = SOURCE_ROOT; }; 86 | BE11EF071BE3FE9500816835 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Example/Base.lproj/LaunchScreen.storyboard; sourceTree = SOURCE_ROOT; }; 87 | BE11EF091BE3FE9500816835 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Example/Base.lproj/Main.storyboard; sourceTree = SOURCE_ROOT; }; 88 | BE11EF0F1BE4001A00816835 /* Version.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Version.swift; sourceTree = ""; }; 89 | BE11EF111BE4002800816835 /* Size.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Size.swift; sourceTree = ""; }; 90 | E2C023AA1D6331010033AD25 /* Device.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Device.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 91 | E2C023AC1D6331010033AD25 /* Device macOS.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Device macOS.h"; sourceTree = ""; }; 92 | E2C023AE1D6331010033AD25 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 93 | E2C023B61D6331A00033AD25 /* Device.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Device.swift; sourceTree = ""; }; 94 | E2C023BF1D6338BB0033AD25 /* Example macOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Example macOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 95 | E2C023C11D6338BB0033AD25 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 96 | E2C023C31D6338BB0033AD25 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 97 | E2C023C51D6338BB0033AD25 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 98 | E2C023C81D6338BB0033AD25 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 99 | E2C023CA1D6338BB0033AD25 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 100 | E2DAC7491D643D9F00E7A07B /* DeviceMacOS.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = DeviceMacOS.swift; path = macOS/DeviceMacOS.swift; sourceTree = ""; }; 101 | F8E8F0391C176DB7006B19D2 /* Type.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Type.swift; sourceTree = ""; }; 102 | /* End PBXFileReference section */ 103 | 104 | /* Begin PBXFrameworksBuildPhase section */ 105 | 001C44651C3C08C000F6599D /* Frameworks */ = { 106 | isa = PBXFrameworksBuildPhase; 107 | buildActionMask = 2147483647; 108 | files = ( 109 | ); 110 | runOnlyForDeploymentPostprocessing = 0; 111 | }; 112 | BE11EEE41BE3FC0300816835 /* Frameworks */ = { 113 | isa = PBXFrameworksBuildPhase; 114 | buildActionMask = 2147483647; 115 | files = ( 116 | 001C44801C3C08C000F6599D /* Device.framework in Frameworks */, 117 | ); 118 | runOnlyForDeploymentPostprocessing = 0; 119 | }; 120 | E2C023A61D6331010033AD25 /* Frameworks */ = { 121 | isa = PBXFrameworksBuildPhase; 122 | buildActionMask = 2147483647; 123 | files = ( 124 | ); 125 | runOnlyForDeploymentPostprocessing = 0; 126 | }; 127 | E2C023BC1D6338BB0033AD25 /* Frameworks */ = { 128 | isa = PBXFrameworksBuildPhase; 129 | buildActionMask = 2147483647; 130 | files = ( 131 | E2C023CE1D6339580033AD25 /* Device.framework in Frameworks */, 132 | ); 133 | runOnlyForDeploymentPostprocessing = 0; 134 | }; 135 | /* End PBXFrameworksBuildPhase section */ 136 | 137 | /* Begin PBXGroup section */ 138 | 001C446A1C3C08C000F6599D /* Device */ = { 139 | isa = PBXGroup; 140 | children = ( 141 | 001C446D1C3C08C000F6599D /* Device.h */, 142 | 001C446C1C3C08C000F6599D /* Info.plist */, 143 | ); 144 | path = Device; 145 | sourceTree = ""; 146 | }; 147 | BE11EEDE1BE3FC0300816835 = { 148 | isa = PBXGroup; 149 | children = ( 150 | BE11EF0C1BE3FFEB00816835 /* Source */, 151 | BE11EEE91BE3FC0300816835 /* Example */, 152 | E2C023C01D6338BB0033AD25 /* Example macOS */, 153 | 001C446A1C3C08C000F6599D /* Device */, 154 | E2C023AB1D6331010033AD25 /* Device macOS */, 155 | BE11EEE81BE3FC0300816835 /* Products */, 156 | ); 157 | sourceTree = ""; 158 | }; 159 | BE11EEE81BE3FC0300816835 /* Products */ = { 160 | isa = PBXGroup; 161 | children = ( 162 | BE11EEE71BE3FC0300816835 /* Example.app */, 163 | 001C44691C3C08C000F6599D /* Device.framework */, 164 | E2C023AA1D6331010033AD25 /* Device.framework */, 165 | E2C023BF1D6338BB0033AD25 /* Example macOS.app */, 166 | ); 167 | name = Products; 168 | sourceTree = ""; 169 | }; 170 | BE11EEE91BE3FC0300816835 /* Example */ = { 171 | isa = PBXGroup; 172 | children = ( 173 | BE11EF061BE3FE9500816835 /* LaunchScreen.storyboard */, 174 | BE11EF081BE3FE9500816835 /* Main.storyboard */, 175 | BE11EEFC1BE3FD9200816835 /* AppDelegate.swift */, 176 | BE11EEFD1BE3FD9200816835 /* Assets.xcassets */, 177 | BE11EEFF1BE3FD9200816835 /* Info.plist */, 178 | BE11EF001BE3FD9200816835 /* ViewController.swift */, 179 | ); 180 | name = Example; 181 | path = Device; 182 | sourceTree = ""; 183 | }; 184 | BE11EF0C1BE3FFEB00816835 /* Source */ = { 185 | isa = PBXGroup; 186 | children = ( 187 | E2C023B51D6331A00033AD25 /* iOS */, 188 | E2C023B81D6331A40033AD25 /* macOS */, 189 | BE11EF0F1BE4001A00816835 /* Version.swift */, 190 | BE11EF111BE4002800816835 /* Size.swift */, 191 | F8E8F0391C176DB7006B19D2 /* Type.swift */, 192 | ); 193 | path = Source; 194 | sourceTree = ""; 195 | }; 196 | E2C023AB1D6331010033AD25 /* Device macOS */ = { 197 | isa = PBXGroup; 198 | children = ( 199 | E2C023AC1D6331010033AD25 /* Device macOS.h */, 200 | E2C023AE1D6331010033AD25 /* Info.plist */, 201 | ); 202 | path = "Device macOS"; 203 | sourceTree = ""; 204 | }; 205 | E2C023B51D6331A00033AD25 /* iOS */ = { 206 | isa = PBXGroup; 207 | children = ( 208 | E2C023B61D6331A00033AD25 /* Device.swift */, 209 | ); 210 | path = iOS; 211 | sourceTree = ""; 212 | }; 213 | E2C023B81D6331A40033AD25 /* macOS */ = { 214 | isa = PBXGroup; 215 | children = ( 216 | E2DAC7491D643D9F00E7A07B /* DeviceMacOS.swift */, 217 | ); 218 | name = macOS; 219 | sourceTree = ""; 220 | }; 221 | E2C023C01D6338BB0033AD25 /* Example macOS */ = { 222 | isa = PBXGroup; 223 | children = ( 224 | E2C023C11D6338BB0033AD25 /* AppDelegate.swift */, 225 | E2C023C31D6338BB0033AD25 /* ViewController.swift */, 226 | E2C023C51D6338BB0033AD25 /* Assets.xcassets */, 227 | E2C023C71D6338BB0033AD25 /* Main.storyboard */, 228 | E2C023CA1D6338BB0033AD25 /* Info.plist */, 229 | ); 230 | path = "Example macOS"; 231 | sourceTree = ""; 232 | }; 233 | /* End PBXGroup section */ 234 | 235 | /* Begin PBXHeadersBuildPhase section */ 236 | 001C44661C3C08C000F6599D /* Headers */ = { 237 | isa = PBXHeadersBuildPhase; 238 | buildActionMask = 2147483647; 239 | files = ( 240 | 001C446E1C3C08C000F6599D /* Device.h in Headers */, 241 | ); 242 | runOnlyForDeploymentPostprocessing = 0; 243 | }; 244 | E2C023A71D6331010033AD25 /* Headers */ = { 245 | isa = PBXHeadersBuildPhase; 246 | buildActionMask = 2147483647; 247 | files = ( 248 | E2C023AD1D6331010033AD25 /* Device macOS.h in Headers */, 249 | ); 250 | runOnlyForDeploymentPostprocessing = 0; 251 | }; 252 | /* End PBXHeadersBuildPhase section */ 253 | 254 | /* Begin PBXNativeTarget section */ 255 | 001C44681C3C08C000F6599D /* Device */ = { 256 | isa = PBXNativeTarget; 257 | buildConfigurationList = 001C44821C3C08C000F6599D /* Build configuration list for PBXNativeTarget "Device" */; 258 | buildPhases = ( 259 | 001C44641C3C08C000F6599D /* Sources */, 260 | 001C44651C3C08C000F6599D /* Frameworks */, 261 | 001C44661C3C08C000F6599D /* Headers */, 262 | 001C44671C3C08C000F6599D /* Resources */, 263 | ); 264 | buildRules = ( 265 | ); 266 | dependencies = ( 267 | ); 268 | name = Device; 269 | productName = Device; 270 | productReference = 001C44691C3C08C000F6599D /* Device.framework */; 271 | productType = "com.apple.product-type.framework"; 272 | }; 273 | BE11EEE61BE3FC0300816835 /* Example */ = { 274 | isa = PBXNativeTarget; 275 | buildConfigurationList = BE11EEF91BE3FC0300816835 /* Build configuration list for PBXNativeTarget "Example" */; 276 | buildPhases = ( 277 | BE11EEE31BE3FC0300816835 /* Sources */, 278 | BE11EEE41BE3FC0300816835 /* Frameworks */, 279 | BE11EEE51BE3FC0300816835 /* Resources */, 280 | 001C44851C3C08C000F6599D /* Embed Frameworks */, 281 | ); 282 | buildRules = ( 283 | ); 284 | dependencies = ( 285 | 001C447F1C3C08C000F6599D /* PBXTargetDependency */, 286 | ); 287 | name = Example; 288 | productName = Device; 289 | productReference = BE11EEE71BE3FC0300816835 /* Example.app */; 290 | productType = "com.apple.product-type.application"; 291 | }; 292 | E2C023A91D6331010033AD25 /* Device macOS */ = { 293 | isa = PBXNativeTarget; 294 | buildConfigurationList = E2C023B11D6331010033AD25 /* Build configuration list for PBXNativeTarget "Device macOS" */; 295 | buildPhases = ( 296 | E2C023A51D6331010033AD25 /* Sources */, 297 | E2C023A61D6331010033AD25 /* Frameworks */, 298 | E2C023A71D6331010033AD25 /* Headers */, 299 | E2C023A81D6331010033AD25 /* Resources */, 300 | ); 301 | buildRules = ( 302 | ); 303 | dependencies = ( 304 | ); 305 | name = "Device macOS"; 306 | productName = "Device macOS"; 307 | productReference = E2C023AA1D6331010033AD25 /* Device.framework */; 308 | productType = "com.apple.product-type.framework"; 309 | }; 310 | E2C023BE1D6338BB0033AD25 /* Example macOS */ = { 311 | isa = PBXNativeTarget; 312 | buildConfigurationList = E2C023CB1D6338BB0033AD25 /* Build configuration list for PBXNativeTarget "Example macOS" */; 313 | buildPhases = ( 314 | E2C023BB1D6338BB0033AD25 /* Sources */, 315 | E2C023BC1D6338BB0033AD25 /* Frameworks */, 316 | E2C023BD1D6338BB0033AD25 /* Resources */, 317 | E2C023D21D6339580033AD25 /* Embed Frameworks */, 318 | ); 319 | buildRules = ( 320 | ); 321 | dependencies = ( 322 | E2C023D11D6339580033AD25 /* PBXTargetDependency */, 323 | ); 324 | name = "Example macOS"; 325 | productName = "Example macOS"; 326 | productReference = E2C023BF1D6338BB0033AD25 /* Example macOS.app */; 327 | productType = "com.apple.product-type.application"; 328 | }; 329 | /* End PBXNativeTarget section */ 330 | 331 | /* Begin PBXProject section */ 332 | BE11EEDF1BE3FC0300816835 /* Project object */ = { 333 | isa = PBXProject; 334 | attributes = { 335 | LastSwiftUpdateCheck = 0730; 336 | LastUpgradeCheck = 1020; 337 | ORGANIZATIONNAME = Ekhoo; 338 | TargetAttributes = { 339 | 001C44681C3C08C000F6599D = { 340 | CreatedOnToolsVersion = 6.4; 341 | LastSwiftMigration = 1020; 342 | }; 343 | BE11EEE61BE3FC0300816835 = { 344 | CreatedOnToolsVersion = 7.1; 345 | LastSwiftMigration = 0930; 346 | ProvisioningStyle = Manual; 347 | }; 348 | E2C023A91D6331010033AD25 = { 349 | CreatedOnToolsVersion = 7.3.1; 350 | }; 351 | E2C023BE1D6338BB0033AD25 = { 352 | CreatedOnToolsVersion = 7.3.1; 353 | }; 354 | }; 355 | }; 356 | buildConfigurationList = BE11EEE21BE3FC0300816835 /* Build configuration list for PBXProject "Device" */; 357 | compatibilityVersion = "Xcode 3.2"; 358 | developmentRegion = en; 359 | hasScannedForEncodings = 0; 360 | knownRegions = ( 361 | en, 362 | Base, 363 | ); 364 | mainGroup = BE11EEDE1BE3FC0300816835; 365 | productRefGroup = BE11EEE81BE3FC0300816835 /* Products */; 366 | projectDirPath = ""; 367 | projectRoot = ""; 368 | targets = ( 369 | 001C44681C3C08C000F6599D /* Device */, 370 | E2C023A91D6331010033AD25 /* Device macOS */, 371 | BE11EEE61BE3FC0300816835 /* Example */, 372 | E2C023BE1D6338BB0033AD25 /* Example macOS */, 373 | ); 374 | }; 375 | /* End PBXProject section */ 376 | 377 | /* Begin PBXResourcesBuildPhase section */ 378 | 001C44671C3C08C000F6599D /* Resources */ = { 379 | isa = PBXResourcesBuildPhase; 380 | buildActionMask = 2147483647; 381 | files = ( 382 | ); 383 | runOnlyForDeploymentPostprocessing = 0; 384 | }; 385 | BE11EEE51BE3FC0300816835 /* Resources */ = { 386 | isa = PBXResourcesBuildPhase; 387 | buildActionMask = 2147483647; 388 | files = ( 389 | BE11EF0A1BE3FE9500816835 /* LaunchScreen.storyboard in Resources */, 390 | BE11EF021BE3FD9200816835 /* Assets.xcassets in Resources */, 391 | BE11EF0B1BE3FE9500816835 /* Main.storyboard in Resources */, 392 | ); 393 | runOnlyForDeploymentPostprocessing = 0; 394 | }; 395 | E2C023A81D6331010033AD25 /* Resources */ = { 396 | isa = PBXResourcesBuildPhase; 397 | buildActionMask = 2147483647; 398 | files = ( 399 | ); 400 | runOnlyForDeploymentPostprocessing = 0; 401 | }; 402 | E2C023BD1D6338BB0033AD25 /* Resources */ = { 403 | isa = PBXResourcesBuildPhase; 404 | buildActionMask = 2147483647; 405 | files = ( 406 | E2C023C61D6338BB0033AD25 /* Assets.xcassets in Resources */, 407 | E2C023C91D6338BB0033AD25 /* Main.storyboard in Resources */, 408 | ); 409 | runOnlyForDeploymentPostprocessing = 0; 410 | }; 411 | /* End PBXResourcesBuildPhase section */ 412 | 413 | /* Begin PBXSourcesBuildPhase section */ 414 | 001C44641C3C08C000F6599D /* Sources */ = { 415 | isa = PBXSourcesBuildPhase; 416 | buildActionMask = 2147483647; 417 | files = ( 418 | 006E76C41C3C09DE00656720 /* Version.swift in Sources */, 419 | 006E76C51C3C09DE00656720 /* Size.swift in Sources */, 420 | 006E76C61C3C09DE00656720 /* Type.swift in Sources */, 421 | E2C023B71D6331A00033AD25 /* Device.swift in Sources */, 422 | ); 423 | runOnlyForDeploymentPostprocessing = 0; 424 | }; 425 | BE11EEE31BE3FC0300816835 /* Sources */ = { 426 | isa = PBXSourcesBuildPhase; 427 | buildActionMask = 2147483647; 428 | files = ( 429 | BE11EF051BE3FD9200816835 /* ViewController.swift in Sources */, 430 | BE11EF011BE3FD9200816835 /* AppDelegate.swift in Sources */, 431 | ); 432 | runOnlyForDeploymentPostprocessing = 0; 433 | }; 434 | E2C023A51D6331010033AD25 /* Sources */ = { 435 | isa = PBXSourcesBuildPhase; 436 | buildActionMask = 2147483647; 437 | files = ( 438 | E2C023B31D6331220033AD25 /* Size.swift in Sources */, 439 | E2C023B21D6331220033AD25 /* Version.swift in Sources */, 440 | E2C023B41D6331220033AD25 /* Type.swift in Sources */, 441 | E2DAC74A1D643D9F00E7A07B /* DeviceMacOS.swift in Sources */, 442 | ); 443 | runOnlyForDeploymentPostprocessing = 0; 444 | }; 445 | E2C023BB1D6338BB0033AD25 /* Sources */ = { 446 | isa = PBXSourcesBuildPhase; 447 | buildActionMask = 2147483647; 448 | files = ( 449 | E2C023C41D6338BB0033AD25 /* ViewController.swift in Sources */, 450 | E2C023C21D6338BB0033AD25 /* AppDelegate.swift in Sources */, 451 | ); 452 | runOnlyForDeploymentPostprocessing = 0; 453 | }; 454 | /* End PBXSourcesBuildPhase section */ 455 | 456 | /* Begin PBXTargetDependency section */ 457 | 001C447F1C3C08C000F6599D /* PBXTargetDependency */ = { 458 | isa = PBXTargetDependency; 459 | target = 001C44681C3C08C000F6599D /* Device */; 460 | targetProxy = 001C447E1C3C08C000F6599D /* PBXContainerItemProxy */; 461 | }; 462 | E2C023D11D6339580033AD25 /* PBXTargetDependency */ = { 463 | isa = PBXTargetDependency; 464 | target = E2C023A91D6331010033AD25 /* Device macOS */; 465 | targetProxy = E2C023D01D6339580033AD25 /* PBXContainerItemProxy */; 466 | }; 467 | /* End PBXTargetDependency section */ 468 | 469 | /* Begin PBXVariantGroup section */ 470 | BE11EF061BE3FE9500816835 /* LaunchScreen.storyboard */ = { 471 | isa = PBXVariantGroup; 472 | children = ( 473 | BE11EF071BE3FE9500816835 /* Base */, 474 | ); 475 | name = LaunchScreen.storyboard; 476 | sourceTree = ""; 477 | }; 478 | BE11EF081BE3FE9500816835 /* Main.storyboard */ = { 479 | isa = PBXVariantGroup; 480 | children = ( 481 | BE11EF091BE3FE9500816835 /* Base */, 482 | ); 483 | name = Main.storyboard; 484 | sourceTree = ""; 485 | }; 486 | E2C023C71D6338BB0033AD25 /* Main.storyboard */ = { 487 | isa = PBXVariantGroup; 488 | children = ( 489 | E2C023C81D6338BB0033AD25 /* Base */, 490 | ); 491 | name = Main.storyboard; 492 | sourceTree = ""; 493 | }; 494 | /* End PBXVariantGroup section */ 495 | 496 | /* Begin XCBuildConfiguration section */ 497 | 001C44831C3C08C000F6599D /* Debug */ = { 498 | isa = XCBuildConfiguration; 499 | buildSettings = { 500 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 501 | CURRENT_PROJECT_VERSION = 1; 502 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 503 | DEFINES_MODULE = YES; 504 | DYLIB_COMPATIBILITY_VERSION = 1; 505 | DYLIB_CURRENT_VERSION = 1; 506 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 507 | GCC_PREPROCESSOR_DEFINITIONS = ( 508 | "DEBUG=1", 509 | "$(inherited)", 510 | ); 511 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 512 | INFOPLIST_FILE = Device/Info.plist; 513 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 514 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 515 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 516 | PRODUCT_NAME = "$(TARGET_NAME)"; 517 | SKIP_INSTALL = YES; 518 | SWIFT_VERSION = 5.0; 519 | TARGETED_DEVICE_FAMILY = "1,2"; 520 | VERSIONING_SYSTEM = "apple-generic"; 521 | VERSION_INFO_PREFIX = ""; 522 | }; 523 | name = Debug; 524 | }; 525 | 001C44841C3C08C000F6599D /* Release */ = { 526 | isa = XCBuildConfiguration; 527 | buildSettings = { 528 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 529 | CURRENT_PROJECT_VERSION = 1; 530 | DEFINES_MODULE = YES; 531 | DYLIB_COMPATIBILITY_VERSION = 1; 532 | DYLIB_CURRENT_VERSION = 1; 533 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 534 | INFOPLIST_FILE = Device/Info.plist; 535 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 536 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 537 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 538 | PRODUCT_NAME = "$(TARGET_NAME)"; 539 | SKIP_INSTALL = YES; 540 | SWIFT_VERSION = 5.0; 541 | TARGETED_DEVICE_FAMILY = "1,2"; 542 | VERSIONING_SYSTEM = "apple-generic"; 543 | VERSION_INFO_PREFIX = ""; 544 | }; 545 | name = Release; 546 | }; 547 | BE11EEF71BE3FC0300816835 /* Debug */ = { 548 | isa = XCBuildConfiguration; 549 | buildSettings = { 550 | ALWAYS_SEARCH_USER_PATHS = NO; 551 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 552 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 553 | CLANG_CXX_LIBRARY = "libc++"; 554 | CLANG_ENABLE_MODULES = YES; 555 | CLANG_ENABLE_OBJC_ARC = YES; 556 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 557 | CLANG_WARN_BOOL_CONVERSION = YES; 558 | CLANG_WARN_COMMA = YES; 559 | CLANG_WARN_CONSTANT_CONVERSION = YES; 560 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 561 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 562 | CLANG_WARN_EMPTY_BODY = YES; 563 | CLANG_WARN_ENUM_CONVERSION = YES; 564 | CLANG_WARN_INFINITE_RECURSION = YES; 565 | CLANG_WARN_INT_CONVERSION = YES; 566 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 567 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 568 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 569 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 570 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 571 | CLANG_WARN_STRICT_PROTOTYPES = YES; 572 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 573 | CLANG_WARN_UNREACHABLE_CODE = YES; 574 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 575 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 576 | COPY_PHASE_STRIP = NO; 577 | DEBUG_INFORMATION_FORMAT = dwarf; 578 | ENABLE_STRICT_OBJC_MSGSEND = YES; 579 | ENABLE_TESTABILITY = YES; 580 | GCC_C_LANGUAGE_STANDARD = gnu99; 581 | GCC_DYNAMIC_NO_PIC = NO; 582 | GCC_NO_COMMON_BLOCKS = YES; 583 | GCC_OPTIMIZATION_LEVEL = 0; 584 | GCC_PREPROCESSOR_DEFINITIONS = ( 585 | "DEBUG=1", 586 | "$(inherited)", 587 | ); 588 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 589 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 590 | GCC_WARN_UNDECLARED_SELECTOR = YES; 591 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 592 | GCC_WARN_UNUSED_FUNCTION = YES; 593 | GCC_WARN_UNUSED_VARIABLE = YES; 594 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 595 | MACOSX_DEPLOYMENT_TARGET = 10.10; 596 | MTL_ENABLE_DEBUG_INFO = YES; 597 | ONLY_ACTIVE_ARCH = YES; 598 | PRODUCT_BUNDLE_IDENTIFIER = Ekhoo.Device; 599 | SDKROOT = iphoneos; 600 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 601 | SWIFT_VERSION = 5.0; 602 | }; 603 | name = Debug; 604 | }; 605 | BE11EEF81BE3FC0300816835 /* Release */ = { 606 | isa = XCBuildConfiguration; 607 | buildSettings = { 608 | ALWAYS_SEARCH_USER_PATHS = NO; 609 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 610 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 611 | CLANG_CXX_LIBRARY = "libc++"; 612 | CLANG_ENABLE_MODULES = YES; 613 | CLANG_ENABLE_OBJC_ARC = YES; 614 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 615 | CLANG_WARN_BOOL_CONVERSION = YES; 616 | CLANG_WARN_COMMA = YES; 617 | CLANG_WARN_CONSTANT_CONVERSION = YES; 618 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 619 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 620 | CLANG_WARN_EMPTY_BODY = YES; 621 | CLANG_WARN_ENUM_CONVERSION = YES; 622 | CLANG_WARN_INFINITE_RECURSION = YES; 623 | CLANG_WARN_INT_CONVERSION = YES; 624 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 625 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 626 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 627 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 628 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 629 | CLANG_WARN_STRICT_PROTOTYPES = YES; 630 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 631 | CLANG_WARN_UNREACHABLE_CODE = YES; 632 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 633 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 634 | COPY_PHASE_STRIP = NO; 635 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 636 | ENABLE_NS_ASSERTIONS = NO; 637 | ENABLE_STRICT_OBJC_MSGSEND = YES; 638 | GCC_C_LANGUAGE_STANDARD = gnu99; 639 | GCC_NO_COMMON_BLOCKS = YES; 640 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 641 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 642 | GCC_WARN_UNDECLARED_SELECTOR = YES; 643 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 644 | GCC_WARN_UNUSED_FUNCTION = YES; 645 | GCC_WARN_UNUSED_VARIABLE = YES; 646 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 647 | MACOSX_DEPLOYMENT_TARGET = 10.10; 648 | MTL_ENABLE_DEBUG_INFO = NO; 649 | PRODUCT_BUNDLE_IDENTIFIER = Ekhoo.Device; 650 | SDKROOT = iphoneos; 651 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 652 | SWIFT_VERSION = 5.0; 653 | VALIDATE_PRODUCT = YES; 654 | }; 655 | name = Release; 656 | }; 657 | BE11EEFA1BE3FC0300816835 /* Debug */ = { 658 | isa = XCBuildConfiguration; 659 | buildSettings = { 660 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 661 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 662 | CLANG_ENABLE_MODULES = YES; 663 | CODE_SIGN_IDENTITY = "Apple Development"; 664 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 665 | CODE_SIGN_STYLE = Manual; 666 | DEVELOPMENT_TEAM = ""; 667 | INFOPLIST_FILE = "$(SRCROOT)/Example/Info.plist"; 668 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 669 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 670 | PRODUCT_BUNDLE_IDENTIFIER = "$(inherited).Example"; 671 | PRODUCT_NAME = "$(TARGET_NAME)"; 672 | PROVISIONING_PROFILE = ""; 673 | PROVISIONING_PROFILE_SPECIFIER = ""; 674 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 675 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 676 | SWIFT_VERSION = 5.0; 677 | TARGETED_DEVICE_FAMILY = "1,2"; 678 | }; 679 | name = Debug; 680 | }; 681 | BE11EEFB1BE3FC0300816835 /* Release */ = { 682 | isa = XCBuildConfiguration; 683 | buildSettings = { 684 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 685 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 686 | CLANG_ENABLE_MODULES = YES; 687 | CODE_SIGN_IDENTITY = "iPhone Developer"; 688 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 689 | CODE_SIGN_STYLE = Manual; 690 | DEVELOPMENT_TEAM = ""; 691 | INFOPLIST_FILE = "$(SRCROOT)/Example/Info.plist"; 692 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 693 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 694 | PRODUCT_BUNDLE_IDENTIFIER = "$(inherited).Example"; 695 | PRODUCT_NAME = "$(TARGET_NAME)"; 696 | PROVISIONING_PROFILE = ""; 697 | PROVISIONING_PROFILE_SPECIFIER = ""; 698 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 699 | SWIFT_VERSION = 5.0; 700 | TARGETED_DEVICE_FAMILY = "1,2"; 701 | }; 702 | name = Release; 703 | }; 704 | E2C023AF1D6331010033AD25 /* Debug */ = { 705 | isa = XCBuildConfiguration; 706 | buildSettings = { 707 | CLANG_ANALYZER_NONNULL = YES; 708 | CODE_SIGN_IDENTITY = ""; 709 | COMBINE_HIDPI_IMAGES = YES; 710 | CURRENT_PROJECT_VERSION = 1; 711 | DEFINES_MODULE = YES; 712 | DYLIB_COMPATIBILITY_VERSION = 1; 713 | DYLIB_CURRENT_VERSION = 1; 714 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 715 | FRAMEWORK_VERSION = A; 716 | INFOPLIST_FILE = "Device macOS/Info.plist"; 717 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 718 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; 719 | MACOSX_DEPLOYMENT_TARGET = 10.13; 720 | PRODUCT_BUNDLE_IDENTIFIER = "com.tbaranes.Device-macOS"; 721 | PRODUCT_NAME = Device; 722 | SDKROOT = macosx; 723 | SKIP_INSTALL = YES; 724 | SWIFT_VERSION = 5.0; 725 | VERSIONING_SYSTEM = "apple-generic"; 726 | VERSION_INFO_PREFIX = ""; 727 | }; 728 | name = Debug; 729 | }; 730 | E2C023B01D6331010033AD25 /* Release */ = { 731 | isa = XCBuildConfiguration; 732 | buildSettings = { 733 | CLANG_ANALYZER_NONNULL = YES; 734 | CODE_SIGN_IDENTITY = ""; 735 | COMBINE_HIDPI_IMAGES = YES; 736 | CURRENT_PROJECT_VERSION = 1; 737 | DEFINES_MODULE = YES; 738 | DYLIB_COMPATIBILITY_VERSION = 1; 739 | DYLIB_CURRENT_VERSION = 1; 740 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 741 | FRAMEWORK_VERSION = A; 742 | INFOPLIST_FILE = "Device macOS/Info.plist"; 743 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 744 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; 745 | MACOSX_DEPLOYMENT_TARGET = 10.13; 746 | PRODUCT_BUNDLE_IDENTIFIER = "com.tbaranes.Device-macOS"; 747 | PRODUCT_NAME = Device; 748 | SDKROOT = macosx; 749 | SKIP_INSTALL = YES; 750 | SWIFT_VERSION = 5.0; 751 | VERSIONING_SYSTEM = "apple-generic"; 752 | VERSION_INFO_PREFIX = ""; 753 | }; 754 | name = Release; 755 | }; 756 | E2C023CC1D6338BB0033AD25 /* Debug */ = { 757 | isa = XCBuildConfiguration; 758 | buildSettings = { 759 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 760 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 761 | CLANG_ANALYZER_NONNULL = YES; 762 | CODE_SIGN_IDENTITY = "-"; 763 | COMBINE_HIDPI_IMAGES = YES; 764 | INFOPLIST_FILE = "Example macOS/Info.plist"; 765 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 766 | MACOSX_DEPLOYMENT_TARGET = 10.13; 767 | PRODUCT_BUNDLE_IDENTIFIER = "Ekhoo.Device.Example-macOS"; 768 | PRODUCT_NAME = "$(TARGET_NAME)"; 769 | SDKROOT = macosx; 770 | SWIFT_VERSION = 5.0; 771 | }; 772 | name = Debug; 773 | }; 774 | E2C023CD1D6338BB0033AD25 /* Release */ = { 775 | isa = XCBuildConfiguration; 776 | buildSettings = { 777 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 778 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 779 | CLANG_ANALYZER_NONNULL = YES; 780 | CODE_SIGN_IDENTITY = "-"; 781 | COMBINE_HIDPI_IMAGES = YES; 782 | INFOPLIST_FILE = "Example macOS/Info.plist"; 783 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 784 | MACOSX_DEPLOYMENT_TARGET = 10.13; 785 | PRODUCT_BUNDLE_IDENTIFIER = "Ekhoo.Device.Example-macOS"; 786 | PRODUCT_NAME = "$(TARGET_NAME)"; 787 | SDKROOT = macosx; 788 | SWIFT_VERSION = 5.0; 789 | }; 790 | name = Release; 791 | }; 792 | /* End XCBuildConfiguration section */ 793 | 794 | /* Begin XCConfigurationList section */ 795 | 001C44821C3C08C000F6599D /* Build configuration list for PBXNativeTarget "Device" */ = { 796 | isa = XCConfigurationList; 797 | buildConfigurations = ( 798 | 001C44831C3C08C000F6599D /* Debug */, 799 | 001C44841C3C08C000F6599D /* Release */, 800 | ); 801 | defaultConfigurationIsVisible = 0; 802 | defaultConfigurationName = Release; 803 | }; 804 | BE11EEE21BE3FC0300816835 /* Build configuration list for PBXProject "Device" */ = { 805 | isa = XCConfigurationList; 806 | buildConfigurations = ( 807 | BE11EEF71BE3FC0300816835 /* Debug */, 808 | BE11EEF81BE3FC0300816835 /* Release */, 809 | ); 810 | defaultConfigurationIsVisible = 0; 811 | defaultConfigurationName = Release; 812 | }; 813 | BE11EEF91BE3FC0300816835 /* Build configuration list for PBXNativeTarget "Example" */ = { 814 | isa = XCConfigurationList; 815 | buildConfigurations = ( 816 | BE11EEFA1BE3FC0300816835 /* Debug */, 817 | BE11EEFB1BE3FC0300816835 /* Release */, 818 | ); 819 | defaultConfigurationIsVisible = 0; 820 | defaultConfigurationName = Release; 821 | }; 822 | E2C023B11D6331010033AD25 /* Build configuration list for PBXNativeTarget "Device macOS" */ = { 823 | isa = XCConfigurationList; 824 | buildConfigurations = ( 825 | E2C023AF1D6331010033AD25 /* Debug */, 826 | E2C023B01D6331010033AD25 /* Release */, 827 | ); 828 | defaultConfigurationIsVisible = 0; 829 | defaultConfigurationName = Release; 830 | }; 831 | E2C023CB1D6338BB0033AD25 /* Build configuration list for PBXNativeTarget "Example macOS" */ = { 832 | isa = XCConfigurationList; 833 | buildConfigurations = ( 834 | E2C023CC1D6338BB0033AD25 /* Debug */, 835 | E2C023CD1D6338BB0033AD25 /* Release */, 836 | ); 837 | defaultConfigurationIsVisible = 0; 838 | defaultConfigurationName = Release; 839 | }; 840 | /* End XCConfigurationList section */ 841 | }; 842 | rootObject = BE11EEDF1BE3FC0300816835 /* Project object */; 843 | } 844 | -------------------------------------------------------------------------------- /Device.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Device.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Device.xcodeproj/xcshareddata/xcschemes/Device macOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 50 | 51 | 52 | 53 | 59 | 60 | 66 | 67 | 68 | 69 | 71 | 72 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /Device.xcodeproj/xcshareddata/xcschemes/Device.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 50 | 51 | 52 | 53 | 59 | 60 | 66 | 67 | 68 | 69 | 71 | 72 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /Device/Device.h: -------------------------------------------------------------------------------- 1 | // 2 | // Device.h 3 | // Device 4 | // 5 | // Created by Takeru Chuganji on 1/5/16. 6 | // Copyright (c) 2016 Ekhoo. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for Device. 12 | FOUNDATION_EXPORT double DeviceVersionNumber; 13 | 14 | //! Project version string for Device. 15 | FOUNDATION_EXPORT const unsigned char DeviceVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /Device/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example macOS/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Example macOS 4 | // 5 | // Created by Tom Baranes on 16/08/16. 6 | // Copyright © 2016 Ekhoo. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | @NSApplicationMain 12 | class AppDelegate: NSObject, NSApplicationDelegate { 13 | 14 | func applicationDidFinishLaunching(aNotification: NSNotification) { 15 | // Insert code here to initialize your application 16 | } 17 | 18 | func applicationWillTerminate(aNotification: NSNotification) { 19 | // Insert code here to tear down your application 20 | } 21 | 22 | } 23 | 24 | -------------------------------------------------------------------------------- /Example macOS/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "size" : "16x16", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "size" : "16x16", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "size" : "32x32", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "size" : "32x32", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "size" : "128x128", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "size" : "128x128", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "size" : "256x256", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "size" : "256x256", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "size" : "512x512", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "size" : "512x512", 51 | "scale" : "2x" 52 | } 53 | ], 54 | "info" : { 55 | "version" : 1, 56 | "author" : "xcode" 57 | } 58 | } -------------------------------------------------------------------------------- /Example macOS/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | Default 511 | 512 | 513 | 514 | 515 | 516 | 517 | Left to Right 518 | 519 | 520 | 521 | 522 | 523 | 524 | Right to Left 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | Default 536 | 537 | 538 | 539 | 540 | 541 | 542 | Left to Right 543 | 544 | 545 | 546 | 547 | 548 | 549 | Right to Left 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | -------------------------------------------------------------------------------- /Example macOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | $(MACOSX_DEPLOYMENT_TARGET) 27 | NSHumanReadableCopyright 28 | Copyright © 2016 Ekhoo. All rights reserved. 29 | NSMainStoryboardFile 30 | Main 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /Example macOS/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // Example macOS 4 | // 5 | // Created by Tom Baranes on 16/08/16. 6 | // Copyright © 2016 Ekhoo. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | import Device 11 | 12 | class ViewController: NSViewController { 13 | 14 | override func viewDidLoad() { 15 | super.viewDidLoad() 16 | 17 | /*** Display the mac version ***/ 18 | switch Device.type() { 19 | case .iMac: print("It's an iMac") 20 | case .macBook: print("It's a MacBook") 21 | case .macBookAir: print("It's a MacBook Air") 22 | case .macBookPro: print("It's a MacBook Pro") 23 | default: print("Unknown device type") 24 | } 25 | 26 | /*** Display the mac screen size ***/ 27 | switch Device.size() { 28 | case .screen11Inch: print("It's a 11 inch screen") 29 | case .screen12Inch: print("It's a 12 inch screen") 30 | case .screen13Inch: print("It's a 13 inch screen") 31 | case .screen15Inch: print("It's a 15 inch screen") 32 | case .screen17Inch: print("It's a 17 inch screen") 33 | case .screen21_5Inch: print("It's a 21.5 inch screen") 34 | case .screen27Inch: print("It's a 27 inch screen") 35 | default: print("Unknown size") 36 | } 37 | 38 | /*** Helpers ***/ 39 | if Device.size() == Size.screen27Inch { 40 | print("It's a 27 inch screen") 41 | } 42 | 43 | if Device.size() > Size.screen15Inch { 44 | print("Your mac screen is larger than 15 inch") 45 | } 46 | 47 | if Device.size() < Size.screen15Inch { 48 | print("Your mac screen is smaller than 15 inch") 49 | } 50 | } 51 | 52 | } 53 | 54 | -------------------------------------------------------------------------------- /Example/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Device 4 | // 5 | // Created by Lucas Ortis on 30/10/2015. 6 | // Copyright © 2015 Ekhoo. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /Example/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ios-marketing", 45 | "size" : "1024x1024", 46 | "scale" : "1x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } -------------------------------------------------------------------------------- /Example/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Example/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /Example/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // Device 4 | // 5 | // Created by Lucas Ortis on 30/10/2015. 6 | // Copyright © 2015 Ekhoo. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import Device 11 | 12 | class ViewController: UIViewController { 13 | 14 | override func viewDidLoad() { 15 | super.viewDidLoad() 16 | 17 | /*** Display the device version ***/ 18 | switch Device.version() { 19 | /*** iPhone ***/ 20 | case .iPhone4: print("It's an iPhone 4") 21 | case .iPhone4S: print("It's an iPhone 4S") 22 | case .iPhone5: print("It's an iPhone 5") 23 | case .iPhone5C: print("It's an iPhone 5C") 24 | case .iPhone5S: print("It's an iPhone 5S") 25 | case .iPhone6: print("It's an iPhone 6") 26 | case .iPhone6S: print("It's an iPhone 6S") 27 | case .iPhone6Plus: print("It's an iPhone 6 Plus") 28 | case .iPhone6SPlus: print("It's an iPhone 6 S Plus") 29 | case .iPhoneSE: print("It's an iPhone SE") 30 | case .iPhone7: print("It's an iPhone 7") 31 | case .iPhone7Plus: print("It's an iPhone 7 Plus") 32 | case .iPhone8: print("It's an iPhone 8") 33 | case .iPhone8Plus: print("It's an iPhone 8 Plus") 34 | case .iPhoneX: print("It's an iPhone X") 35 | case .iPhoneXS: print("It's an iPhone Xs") 36 | case .iPhoneXS_Max: print("It's an iPhone Xs Max") 37 | case .iPhoneXR: print("It's an iPhone Xr") 38 | 39 | /*** iPad ***/ 40 | case .iPad1: print("It's an iPad 1") 41 | case .iPad2: print("It's an iPad 2") 42 | case .iPad3: print("It's an iPad 3") 43 | case .iPad4: print("It's an iPad 4") 44 | case .iPad5: print("It's an iPad 5") 45 | case .iPad6: print("It's an iPad 6") 46 | case .iPadAir: print("It's an iPad Air") 47 | case .iPadAir2: print("It's an iPad Air 2") 48 | case .iPadMini: print("It's an iPad Mini") 49 | case .iPadMini2: print("It's an iPad Mini 2") 50 | case .iPadMini3: print("It's an iPad Mini 3") 51 | case .iPadMini4: print("It's an iPad Mini 4") 52 | case .iPadPro9_7Inch: print("It's an iPad Pro 9.7 Inch") 53 | case .iPadPro10_5Inch: print("It's an iPad Pro 10.5 Inch") 54 | case .iPadPro12_9Inch: print("It's an iPad Pro 12.9 Inch") 55 | 56 | /*** iPod ***/ 57 | case .iPodTouch1Gen: print("It's a iPod touch generation 1") 58 | case .iPodTouch2Gen: print("It's a iPod touch generation 2") 59 | case .iPodTouch3Gen: print("It's a iPod touch generation 3") 60 | case .iPodTouch4Gen: print("It's a iPod touch generation 4") 61 | case .iPodTouch5Gen: print("It's a iPod touch generation 5") 62 | case .iPodTouch6Gen: print("It's a iPod touch generation 6") 63 | 64 | /*** simulator ***/ 65 | case .simulator: print("It's a Simulator") 66 | 67 | /*** unknown ***/ 68 | default: print("It's an unknown device") 69 | } 70 | 71 | /*** Display the device screen size ***/ 72 | switch Device.size() { 73 | case .screen3_5Inch: print("It's a 3.5 inch screen") 74 | case .screen4Inch: print("It's a 4 inch screen") 75 | case .screen4_7Inch: print("It's a 4.7 inch screen") 76 | case .screen5_5Inch: print("It's a 5.5 inch screen") 77 | case .screen5_8Inch: print("It's a 5.8 inch screen") 78 | case .screen6_1Inch: print("It's a 6.1 inch screen") 79 | case .screen6_5Inch: print("It's a 6.8 inch screen") 80 | case .screen7_9Inch: print("It's a 7.9 inch screen") 81 | case .screen9_7Inch: print("It's a 9.7 inch screen") 82 | case .screen10_5Inch: print("It's a 10.5 inch screen") 83 | case .screen11Inch: print("It's an 11 inch screen") 84 | case .screen12_9Inch: print("It's a 12.9 inch screen") 85 | case .screen13Inch: print("It's a 13 inch screen") 86 | default: print("Unknown size") 87 | } 88 | 89 | switch Device.type() { 90 | case .iPod: print("It's an iPod") 91 | case .iPhone: print("It's an iPhone") 92 | case .iPad: print("It's an iPad") 93 | case .simulator: print("It's a simulated device") 94 | default: print("Unknown device type") 95 | } 96 | 97 | /*** Helpers ***/ 98 | if Device.size() == Size.screen4Inch { 99 | print("It's a 4 inch screen") 100 | } 101 | 102 | if Device.size() > Size.screen4_7Inch { 103 | print("Your device screen is larger than 4.7 inch") 104 | } 105 | 106 | if Device.size() < Size.screen4_7Inch { 107 | print("Your device screen is smaller than 4.7 inch") 108 | } 109 | } 110 | 111 | override func didReceiveMemoryWarning() { 112 | super.didReceiveMemoryWarning() 113 | } 114 | 115 | 116 | } 117 | 118 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Lucas Ortis 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 | 23 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.0 2 | import PackageDescription 3 | 4 | let package = Package( 5 | name: "Device", 6 | platforms: [.iOS(.v9), .macOS(.v10_10)], 7 | products: [ 8 | .library( 9 | name: "Device", 10 | targets: ["Device"] 11 | ) 12 | ], 13 | targets: [ 14 | .target( 15 | name: "Device", 16 | path: "Source" 17 | ) 18 | ], 19 | swiftLanguageVersions: [.v4, .v4_2, .v5] 20 | ) 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Device](https://github.com/Ekhoo/Device/blob/master/Source/Asset/device.png) 2 | 3 | [![Version](https://img.shields.io/cocoapods/v/Device.svg?style=flat)](http://cocoapods.org/pods/Device) 4 | [![License](https://img.shields.io/cocoapods/l/Device.svg?style=flat)](http://cocoapods.org/pods/Device) 5 | [![Platform](https://img.shields.io/cocoapods/p/Device.svg?style=flat)](http://cocoapods.org/pods/Device) 6 | ![](https://img.shields.io/badge/Supported-iOS8%20%7C%20OSX%2010.10-4BC51D.svg?style=flat-square) 7 | [![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) 8 | [![Swift Package Manager](https://img.shields.io/badge/Swift_Package_Manager-compatible-orange?style=flat-square)](https://img.shields.io/badge/Swift_Package_Manager-compatible-orange?style=flat-square) 9 | ![](https://img.shields.io/badge/Swift-5.0-orange.svg?style=flat) 10 | [![Twitter](https://img.shields.io/badge/Twitter-@LucasEkhoo-blue.svg?style=flat)](http://twitter.com/LucasEkhoo) 11 | 12 | Device detect the current  device model and screen size. 13 | 14 | # Installation 15 | ## CocoaPods 16 | Device is available through [CocoaPods](http://cocoapods.org). To install 17 | it, simply add the following line to your Podfile: 18 | 19 | ```ruby 20 | pod "Device", '~> 3.7.0' 21 | ``` 22 | 23 | ## Carthage 24 | 25 | [Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. 26 | 27 | You can install Carthage with [Homebrew](http://brew.sh/) using the following command: 28 | 29 | ```bash 30 | $ brew update 31 | $ brew install carthage 32 | ``` 33 | 34 | To integrate Device into your Xcode project using Carthage, specify it in your `Cartfile`: 35 | 36 | ```ogdl 37 | github "Ekhoo/Device" ~> 3.7.0 38 | ``` 39 | 40 | Run `carthage update` to build the framework and drag the built `Device.framework` into your Xcode project. 41 | 42 | ### Swift Package Manager 43 | 44 | The [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the `swift` compiler. 45 | 46 | Once you have your Swift package set up, adding Device as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`. 47 | 48 | ```swift 49 | dependencies: [ 50 | .package(url: "https://github.com/Ekhoo/Device.git", from: "3.7.0") 51 | ] 52 | ``` 53 | 54 | # Usage 55 | ## iOS 56 | ### Device version 57 | ```swift 58 | func myFunc() { 59 | /*** Display the device version ***/ 60 | switch Device.version() { 61 | /*** iPhone ***/ 62 | case .iPhone4: print("It's an iPhone 4") 63 | case .iPhone4S: print("It's an iPhone 4S") 64 | case .iPhone5: print("It's an iPhone 5") 65 | case .iPhone5C: print("It's an iPhone 5C") 66 | case .iPhone5S: print("It's an iPhone 5S") 67 | case .iPhone6: print("It's an iPhone 6") 68 | case .iPhone6S: print("It's an iPhone 6S") 69 | case .iPhone6Plus: print("It's an iPhone 6 Plus") 70 | case .iPhone6SPlus: print("It's an iPhone 6 S Plus") 71 | case .iPhoneSE: print("It's an iPhone SE") 72 | case .iPhone7: print("It's an iPhone 7") 73 | case .iPhone7Plus: print("It's an iPhone 7 Plus") 74 | case .iPhone8: print("It's an iPhone 8") 75 | case .iPhone8Plus: print("It's an iPhone 8 Plus") 76 | case .iPhoneX: print("It's an iPhone X") 77 | case .iPhoneXS: print("It's an iPhone Xs") 78 | case .iPhoneXS_Max: print("It's an iPhone Xs Max") 79 | case .iPhoneXR: print("It's an iPhone Xr") 80 | 81 | /*** iPad ***/ 82 | case .iPad1: print("It's an iPad 1") 83 | case .iPad2: print("It's an iPad 2") 84 | case .iPad3: print("It's an iPad 3") 85 | case .iPad4: print("It's an iPad 4") 86 | case .iPad5: print("It's an iPad 5") 87 | case .iPad6: print("It's an iPad 6") 88 | case .iPadAir: print("It's an iPad Air") 89 | case .iPadAir2: print("It's an iPad Air 2") 90 | case .iPadMini: print("It's an iPad Mini") 91 | case .iPadMini2: print("It's an iPad Mini 2") 92 | case .iPadMini3: print("It's an iPad Mini 3") 93 | case .iPadMini4: print("It's an iPad Mini 4") 94 | case .iPadPro9_7Inch: print("It's an iPad Pro 9.7 Inch") 95 | case .iPadPro10_5Inch: print("It's an iPad Pro 10.5 Inch") 96 | case .iPadPro12_9Inch: print("It's an iPad Pro 12.9 Inch") 97 | 98 | /*** iPod ***/ 99 | case .iPodTouch1Gen: print("It's a iPod touch generation 1") 100 | case .iPodTouch2Gen: print("It's a iPod touch generation 2") 101 | case .iPodTouch3Gen: print("It's a iPod touch generation 3") 102 | case .iPodTouch4Gen: print("It's a iPod touch generation 4") 103 | case .iPodTouch5Gen: print("It's a iPod touch generation 5") 104 | case .iPodTouch6Gen: print("It's a iPod touch generation 6") 105 | 106 | /*** Simulator ***/ 107 | case .Simulator: print("It's a Simulator") 108 | 109 | /*** Unknown ***/ 110 | default: print("It's an unknown device") 111 | } 112 | } 113 | ``` 114 | 115 | ## Device screen size 116 | ```swift 117 | func myFunc() { 118 | /*** Display the device screen size ***/ 119 | switch Device.size() { 120 | case .screen3_5Inch: print("It's a 3.5 inch screen") 121 | case .screen4Inch: print("It's a 4 inch screen") 122 | case .screen4_7Inch: print("It's a 4.7 inch screen") 123 | case .screen5_5Inch: print("It's a 5.5 inch screen") 124 | case .screen5_8Inch: print("It's a 5.8 inch screen") 125 | case .screen6_1Inch: print("It's a 6.1 inch screen") 126 | case .screen6_5Inch: print("It's a 6.8 inch screen") 127 | case .screen7_9Inch: print("It's a 7.9 inch screen") 128 | case .screen9_7Inch: print("It's a 9.7 inch screen") 129 | case .screen10_5Inch: print("It's a 10.5 inch screen") 130 | case .screen12_9Inch: print("It's a 12.9 inch screen") 131 | default: print("Unknown size") 132 | } 133 | } 134 | ``` 135 | 136 | ## Device type 137 | ```swift 138 | func myFunc() { 139 | /*** Display the device type ***/ 140 | switch Device.type() { 141 | case .iPod: print("It's an iPod") 142 | case .iPhone: print("It's an iPhone") 143 | case .iPad: print("It's an iPad") 144 | case .Simulator: print("It's a Simulated device") 145 | default: print("Unknown device type") 146 | } 147 | } 148 | 149 | ``` 150 | 151 | or 152 | 153 | ```swift 154 | func myFunc() { 155 | /*** Display the device type ***/ 156 | if (Device.isPad()){ 157 | print("It's an iPad") 158 | } 159 | else if (Device.isPhone()){ 160 | print("It's an iPhone") 161 | } 162 | else if (Device.isPod()){ 163 | print("It's an iPod") 164 | } 165 | else if (Device.isSimulator()){ 166 | print("It's a Simulated device") 167 | } 168 | } 169 | 170 | ``` 171 | 172 | ## Mac 173 | ### Mac version 174 | ```swift 175 | func myFunc() { 176 | /*** Display the mac version ***/ 177 | switch Device.type() { 178 | case .iMac: print("It's an iMac") 179 | case .macBook: print("It's a MacBook") 180 | case .macBookAir: print("It's a MacBook Air") 181 | case .macBookPro: print("It's a MacBook Pro") 182 | default: print("Unknown device type") 183 | } 184 | } 185 | ``` 186 | 187 | ## Mac screen size 188 | ```swift 189 | func myFunc() { 190 | /*** Display the mac screen size ***/ 191 | switch Device.size() { 192 | case .screen11Inch: print("It's a 11 inch screen") 193 | case .screen12Inch: print("It's a 12 inch screen") 194 | case .screen13Inch: print("It's a 13 inch screen") 195 | case .screen15Inch: print("It's a 15 inch screen") 196 | case .screen17Inch: print("It's a 17 inch screen") 197 | case .screen21_5Inch: print("It's a 21.5 inch screen") 198 | case .screen27Inch: print("It's a 27 inch screen") 199 | default: print("Unknown size") 200 | } 201 | } 202 | ``` 203 | 204 | ## Helpers 205 | ```swift 206 | func myFunc() { 207 | /*** Helpers ***/ 208 | if Device.size() == Size.screen4Inch { 209 | print("It's a 4 inch screen") 210 | } 211 | 212 | if Device.size() > Size.screen4_7Inch { 213 | print("Your device screen is larger than 4.7 inch") 214 | } 215 | 216 | if Device.size() < Size.screen4_7Inch { 217 | print("Your device screen is smaller than 4.7 inch") 218 | } 219 | 220 | if Device.size() == Size.screen27Inch { 221 | print("It's a 27 inch screen") 222 | } 223 | 224 | if Device.size() > Size.screen15Inch { 225 | print("Your mac screen is larger than 15 inch") 226 | } 227 | 228 | if Device.size() < Size.screen15Inch { 229 | print("Your mac screen is smaller than 15 inch") 230 | } 231 | 232 | if Device.isRetina() { 233 | print("It's a retina display") 234 | } 235 | 236 | } 237 | ``` 238 | 239 | # Video Tutorial by Alex Nagy (@rebeloper): 240 | - https://www.youtube.com/watch?v=cTZcOaGgD-E 241 | 242 | [![YouTube](https://user-images.githubusercontent.com/2488011/53433240-ba33a780-39fc-11e9-820b-9e1017adce18.png)](https://www.youtube.com/watch?v=cTZcOaGgD-E) 243 | 244 | ## Privacy 245 | Device does not collect any data. We provide this notice to help you fill out [App Privacy Details](https://developer.apple.com/app-store/app-privacy-details/). Since Device is not using any of privacy required reason API as listed by Apple [here](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api) xcprivacy manifest is not needed for this SDK. 246 | 247 | # Author 248 | Lucas Ortis: 249 | - me@lucas-ortis.com 250 | - [@LucasEkhoo](https://twitter.com/LucasEkhoo) 251 | - [LinkedIn](https://fr.linkedin.com/in/lucasortis) 252 | 253 | # Maintenance 254 | Pran Kishore: 255 | - kishorepran@gmail.com 256 | - [LinkedIn](https://www.linkedin.com/in/pran-kishore/) 257 | 258 | # License 259 | 260 | Device is available under the MIT license. See the LICENSE file for more info. 261 | -------------------------------------------------------------------------------- /Source/Asset/device.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ekhoo/Device/36e221b337364a0b2a673a6bbbfb94a251391aac/Source/Asset/device.png -------------------------------------------------------------------------------- /Source/Size.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Size.swift 3 | // Device 4 | // 5 | // Created by Lucas Ortis on 30/10/2015. 6 | // Copyright © 2015 Ekhoo. All rights reserved. 7 | // 8 | 9 | public enum Size: Int, Comparable { 10 | case unknownSize = 0 11 | #if os(iOS) 12 | /// iPhone 2G, 3G, 3GS, 4, 4s, iPod Touch 4th gen. 13 | case screen3_5Inch 14 | /// iPhone 5, 5s, 5c, SE, iPod Touch 5-7th gen. 15 | case screen4Inch 16 | /// iPhone 6, 6s, 7, 8, SE 2nd gen. 17 | case screen4_7Inch 18 | /// iPhone 12 Mini 19 | case screen5_4Inch 20 | /// iPhone 6+, 6s+, 7+, 8+ 21 | case screen5_5Inch 22 | /// iPhone X, Xs, 11 Pro 23 | case screen5_8Inch 24 | /// iPhone Xr, 11, 12, 12 Pro, 13, 13 Pro, 14 25 | case screen6_1Inch 26 | /// iPhone 14 Pro, iPhone 15, iPhone 15 Pro, iPhone 16 27 | case screen6_1Inch_2 28 | /// iPhone 16 Pro 29 | case screen6_3Inch 30 | /// iPhone Xs Max, 11 Pro Max 31 | case screen6_5Inch 32 | /// iPhone 12 Pro Max, 13 Pro Max, 14 Plus, 15 Plus 33 | case screen6_7Inch 34 | /// iPhone 14 Pro Max, iPhone 15 Pro Max, iPhone 16 Plus 35 | case screen6_7Inch_2 36 | /// iPhone 16 Pro Max 37 | case screen6_9Inch 38 | /// iPad Mini 39 | case screen7_9Inch 40 | /// iPad Mini 41 | case screen8_3Inch 42 | /// iPad, iPad Pro (9.7-inch) 43 | case screen9_7Inch 44 | /// iPad (10.2-inch) 45 | case screen10_2Inch 46 | /// iPad Pro (10.5-inch) 47 | case screen10_5Inch 48 | /// iPad Air 4th gen. 49 | case screen10_9Inch 50 | /// iPad Pro (11-inch) 51 | case screen11Inch 52 | /// iPad Pro (12.9-inch) 53 | case screen12_9Inch 54 | /// iPad Pro (13-inch) 55 | case screen13Inch 56 | #elseif os(OSX) 57 | case screen11Inch 58 | case screen12Inch 59 | case screen13Inch 60 | case screen15Inch 61 | case screen16Inch 62 | case screen17Inch 63 | case screen20Inch 64 | case screen21_5Inch 65 | case screen24Inch 66 | case screen27Inch 67 | #endif 68 | } 69 | 70 | public func <(lhs: Size, rhs: Size) -> Bool { 71 | return lhs.rawValue < rhs.rawValue 72 | } 73 | 74 | public func ==(lhs: Size, rhs: Size) -> Bool { 75 | return lhs.rawValue == rhs.rawValue 76 | } 77 | -------------------------------------------------------------------------------- /Source/Type.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Type.swift 3 | // Device 4 | // 5 | // Created by Stefan Jansen on 08-12-15. 6 | // Copyright © 2015 Ekhoo. All rights reserved. 7 | // 8 | 9 | public enum Type: String { 10 | #if os(iOS) 11 | case iPhone 12 | case iPad 13 | case iPod 14 | case simulator 15 | #elseif os(OSX) 16 | case iMac 17 | case macMini 18 | case macPro 19 | case macBook 20 | case macBookAir 21 | case macBookPro 22 | case xserve 23 | #endif 24 | case unknown 25 | } 26 | -------------------------------------------------------------------------------- /Source/Version.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Version.swift 3 | // Device 4 | // 5 | // Created by Lucas Ortis on 30/10/2015. 6 | // Copyright © 2015 Ekhoo. All rights reserved. 7 | // 8 | 9 | public enum Version: String { 10 | /*** iPhone ***/ 11 | case iPhone2G 12 | case iPhone3G 13 | case iPhone3GS 14 | case iPhone4 15 | case iPhone4S 16 | case iPhone5 17 | case iPhone5C 18 | case iPhone5S 19 | case iPhone6 20 | case iPhone6Plus 21 | case iPhone6S 22 | case iPhone6SPlus 23 | case iPhoneSE 24 | case iPhone7 25 | case iPhone7Plus 26 | case iPhone8 27 | case iPhone8Plus 28 | case iPhoneX 29 | case iPhoneXS 30 | case iPhoneXS_Max 31 | case iPhoneXR 32 | case iPhone11 33 | case iPhone11Pro 34 | case iPhone11Pro_Max 35 | case iPhoneSE2 36 | case iPhone12Mini 37 | case iPhone12 38 | case iPhone12Pro 39 | case iPhone12Pro_Max 40 | case iPhone13Mini 41 | case iPhone13 42 | case iPhone13Pro 43 | case iPhone13Pro_Max 44 | case iPhoneSE3 45 | case iPhone14 46 | case iPhone14Plus 47 | case iPhone14Pro 48 | case iPhone14Pro_Max 49 | case iPhone15 50 | case iPhone15Plus 51 | case iPhone15Pro 52 | case iPhone15Pro_Max 53 | case iPhone16 54 | case iPhone16Plus 55 | case iPhone16Pro 56 | case iPhone16Pro_Max 57 | case iPhone16e 58 | 59 | /*** iPad ***/ 60 | case iPad1 61 | case iPad2 62 | case iPad3 63 | case iPad4 64 | case iPad5 65 | case iPad6 66 | case iPad7 67 | case iPad8 68 | case iPad9 69 | case iPad10 70 | case iPadA16 71 | case iPadAir 72 | case iPadAir2 73 | case iPadAir3 74 | case iPadAir4 75 | case iPadAir5 76 | case iPadMini 77 | case iPadMini2 78 | case iPadMini3 79 | case iPadMini4 80 | case iPadMini5 81 | case iPadMini6 82 | case iPadMini7 83 | case iPadAirM2_11Inch 84 | case iPadAirM2_13Inch 85 | case iPadAirM3_11Inch 86 | case iPadAirM3_13Inch 87 | 88 | /*** iPadPro ***/ 89 | case iPadPro9_7Inch 90 | case iPadPro12_9Inch 91 | case iPadPro10_5Inch 92 | case iPadPro12_9Inch2 93 | case iPadPro11_0Inch 94 | case iPadPro12_9Inch3 95 | case iPadPro11_0Inch2 96 | case iPadPro11_0Inch3 97 | case iPadPro11_0Inch4 98 | case iPadPro12_9Inch4 99 | case iPadPro12_9Inch5 100 | case iPadPro12_9Inch6 101 | case iPadProM4_11Inch 102 | case iPadProM4_13Inch 103 | 104 | /*** iPod ***/ 105 | case iPodTouch1Gen 106 | case iPodTouch2Gen 107 | case iPodTouch3Gen 108 | case iPodTouch4Gen 109 | case iPodTouch5Gen 110 | case iPodTouch6Gen 111 | case iPodTouch7Gen 112 | 113 | /*** simulator ***/ 114 | case simulator 115 | 116 | /*** unknown ***/ 117 | case unknown 118 | } 119 | -------------------------------------------------------------------------------- /Source/iOS/Device.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Device.swift 3 | // Device 4 | // 5 | // Created by Lucas Ortis on 30/10/2015. 6 | // Copyright © 2015 Ekhoo. All rights reserved. 7 | // 8 | 9 | #if os(iOS) 10 | import UIKit 11 | 12 | open class Device { 13 | /// Get Version Code of the device. 14 | /// - Parameter detectSimulator: if true, reture the Version Code like real device. Otherwise return Simulator. 15 | /// - Returns: Version Code 16 | static fileprivate func getVersionCode(detectSimulator: Bool = false) -> String { 17 | #if targetEnvironment(simulator) 18 | if detectSimulator { 19 | return ProcessInfo().environment["SIMULATOR_MODEL_IDENTIFIER"]! 20 | } 21 | #endif 22 | 23 | var systemInfo = utsname() 24 | uname(&systemInfo) 25 | 26 | let versionCode: String = String(validatingUTF8: NSString(bytes: &systemInfo.machine, length: Int(_SYS_NAMELEN), encoding: String.Encoding.ascii.rawValue)!.utf8String!)! 27 | 28 | return versionCode 29 | } 30 | 31 | static fileprivate func getVersion(code: String) -> Version { 32 | switch code { 33 | /*** iPhone ***/ 34 | case "iPhone1,1": return .iPhone2G 35 | case "iPhone1,2": return .iPhone3G 36 | case "iPhone2,1": return .iPhone3GS 37 | case "iPhone3,1", "iPhone3,2", "iPhone3,3": return .iPhone4 38 | case "iPhone4,1", "iPhone4,2", "iPhone4,3": return .iPhone4S 39 | case "iPhone5,1", "iPhone5,2": return .iPhone5 40 | case "iPhone5,3", "iPhone5,4": return .iPhone5C 41 | case "iPhone6,1", "iPhone6,2": return .iPhone5S 42 | case "iPhone7,2": return .iPhone6 43 | case "iPhone7,1": return .iPhone6Plus 44 | case "iPhone8,1": return .iPhone6S 45 | case "iPhone8,2": return .iPhone6SPlus 46 | case "iPhone8,3", "iPhone8,4": return .iPhoneSE 47 | case "iPhone9,1", "iPhone9,3": return .iPhone7 48 | case "iPhone9,2", "iPhone9,4": return .iPhone7Plus 49 | case "iPhone10,1", "iPhone10,4": return .iPhone8 50 | case "iPhone10,2", "iPhone10,5": return .iPhone8Plus 51 | case "iPhone10,3", "iPhone10,6": return .iPhoneX 52 | case "iPhone11,2": return .iPhoneXS 53 | case "iPhone11,4", "iPhone11,6": return .iPhoneXS_Max 54 | case "iPhone11,8": return .iPhoneXR 55 | case "iPhone12,1": return .iPhone11 56 | case "iPhone12,3": return .iPhone11Pro 57 | case "iPhone12,5": return .iPhone11Pro_Max 58 | case "iPhone12,8": return .iPhoneSE2 59 | case "iPhone13,1": return .iPhone12Mini 60 | case "iPhone13,2": return .iPhone12 61 | case "iPhone13,3": return .iPhone12Pro 62 | case "iPhone13,4": return .iPhone12Pro_Max 63 | case "iPhone14,4": return .iPhone13Mini 64 | case "iPhone14,5": return .iPhone13 65 | case "iPhone14,2": return .iPhone13Pro 66 | case "iPhone14,3": return .iPhone13Pro_Max 67 | case "iPhone14,6": return .iPhoneSE3 68 | case "iPhone14,7": return .iPhone14 69 | case "iPhone14,8": return .iPhone14Plus 70 | case "iPhone15,2": return .iPhone14Pro 71 | case "iPhone15,3": return .iPhone14Pro_Max 72 | case "iPhone15,4": return .iPhone15 73 | case "iPhone15,5": return .iPhone15Plus 74 | case "iPhone16,1": return .iPhone15Pro 75 | case "iPhone16,2": return .iPhone15Pro_Max 76 | case "iPhone17,3": return .iPhone16 77 | case "iPhone17,4": return .iPhone16Plus 78 | case "iPhone17,1": return .iPhone16Pro 79 | case "iPhone17,2": return .iPhone16Pro_Max 80 | case "iPhone17,5": return .iPhone16e 81 | 82 | /*** iPad ***/ 83 | case "iPad1,1", "iPad1,2": return .iPad1 84 | case "iPad2,1", "iPad2,2", "iPad2,3", "iPad2,4": return .iPad2 85 | case "iPad3,1", "iPad3,2", "iPad3,3": return .iPad3 86 | case "iPad3,4", "iPad3,5", "iPad3,6": return .iPad4 87 | case "iPad6,11", "iPad6,12": return .iPad5 88 | case "iPad7,5", "iPad7,6": return .iPad6 89 | case "iPad7,11", "iPad7,12": return .iPad7 90 | case "iPad11,6", "iPad11,7": return .iPad8 91 | case "iPad12,1", "iPad12,2": return .iPad9 92 | case "iPad13,18", "iPad13,19": return .iPad10 93 | case "iPad15,7", "iPad15,8": return .iPadA16 94 | case "iPad4,1", "iPad4,2", "iPad4,3": return .iPadAir 95 | case "iPad5,3", "iPad5,4": return .iPadAir2 96 | case "iPad11,3", "iPad11,4": return .iPadAir3 97 | case "iPad13,1", "iPad13,2": return .iPadAir4 98 | case "iPad13,16", "iPad13,17": return .iPadAir5 99 | case "iPad2,5", "iPad2,6", "iPad2,7": return .iPadMini 100 | case "iPad4,4", "iPad4,5", "iPad4,6": return .iPadMini2 101 | case "iPad4,7", "iPad4,8", "iPad4,9": return .iPadMini3 102 | case "iPad5,1", "iPad5,2": return .iPadMini4 103 | case "iPad11,1", "iPad11,2": return .iPadMini5 104 | case "iPad14,1", "iPad14,2": return .iPadMini6 105 | case "iPad16,1", "iPad16,2": return .iPadMini7 106 | case "iPad14,8", "iPad14,9": return .iPadAirM2_11Inch 107 | case "iPad14,10", "iPad14,11": return .iPadAirM2_13Inch 108 | case "iPad15,3", "iPad15,4": return .iPadAirM3_11Inch 109 | case "iPad15,5", "iPad15,6": return .iPadAirM3_13Inch 110 | 111 | /*** iPadPro ***/ 112 | case "iPad6,3", "iPad6,4": return .iPadPro9_7Inch 113 | case "iPad6,7", "iPad6,8": return .iPadPro12_9Inch 114 | case "iPad7,1", "iPad7,2": return .iPadPro12_9Inch2 115 | case "iPad7,3", "iPad7,4": return .iPadPro10_5Inch 116 | case "iPad8,1", "iPad8,2", "iPad8,3", "iPad8,4": return .iPadPro11_0Inch 117 | case "iPad8,5", "iPad8,6", "iPad8,7", "iPad8,8": return .iPadPro12_9Inch3 118 | case "iPad8,9", "iPad8,10": return .iPadPro11_0Inch2 119 | case "iPad13,4", "iPad13,5", "iPad13,6", "iPad13,7": return .iPadPro11_0Inch3 120 | case "iPad8,11", "iPad8,12": return .iPadPro12_9Inch4 121 | case "iPad13,8", "iPad13,9", "iPad13,10", "iPad13,11": return .iPadPro12_9Inch5 122 | case "iPad14,3", "iPad14,4": return .iPadPro11_0Inch4 123 | case "iPad14,5", "iPad14,6": return .iPadPro12_9Inch6 124 | case "iPad16,3", "iPad16,4": return .iPadProM4_11Inch 125 | case "iPad16,5", "iPad16,6": return .iPadProM4_13Inch 126 | 127 | /*** iPod ***/ 128 | case "iPod1,1": return .iPodTouch1Gen 129 | case "iPod2,1": return .iPodTouch2Gen 130 | case "iPod3,1": return .iPodTouch3Gen 131 | case "iPod4,1": return .iPodTouch4Gen 132 | case "iPod5,1": return .iPodTouch5Gen 133 | case "iPod7,1": return .iPodTouch6Gen 134 | case "iPod9,1": return .iPodTouch7Gen 135 | 136 | /*** Simulator ***/ 137 | case "i386", "x86_64", "arm64": return .simulator 138 | 139 | default: 140 | assertionFailure("New Device Found! Model Code:\(code). Please create a PR to the repo.") 141 | return .unknown 142 | } 143 | } 144 | 145 | static fileprivate func getType(code: String, detectSimulator: Bool) -> Type { 146 | let versionCode = getVersionCode(detectSimulator: detectSimulator) 147 | 148 | if versionCode.contains("iPhone") { 149 | return .iPhone 150 | } else if versionCode.contains("iPad") { 151 | return .iPad 152 | } else if versionCode.contains("iPod") { 153 | return .iPod 154 | } else if versionCode == "i386" || versionCode == "x86_64" || versionCode == "arm64" { 155 | return .simulator 156 | } else { 157 | return .unknown 158 | } 159 | } 160 | 161 | static public func version(detectSimulator: Bool = false) -> Version { 162 | return getVersion(code: getVersionCode(detectSimulator: detectSimulator)) 163 | } 164 | 165 | static public func size() -> Size { 166 | let w: Double = Double(UIScreen.main.bounds.width) 167 | let h: Double = Double(UIScreen.main.bounds.height) 168 | let screenHeight: Double = max(w, h) 169 | 170 | switch screenHeight { 171 | case 240, 480: 172 | return .screen3_5Inch 173 | case 568: 174 | return .screen4Inch 175 | case 667: 176 | return UIScreen.main.scale == 3.0 ? .screen5_5Inch : .screen4_7Inch 177 | case 736: 178 | return .screen5_5Inch 179 | case 812: 180 | switch version() { 181 | case .iPhone12Mini: 182 | return .screen5_4Inch 183 | default: 184 | return .screen5_8Inch 185 | } 186 | case 844: 187 | return .screen6_1Inch 188 | case 852: 189 | return .screen6_1Inch_2 190 | case 874: 191 | return .screen6_3Inch 192 | case 896: 193 | switch version() { 194 | case .iPhoneXS_Max, .iPhone11Pro_Max: 195 | return .screen6_5Inch 196 | default: 197 | return .screen6_1Inch 198 | } 199 | case 926: 200 | return .screen6_7Inch 201 | case 932: 202 | return .screen6_7Inch_2 203 | case 956: 204 | return .screen6_9Inch 205 | case 1024: 206 | switch version() { 207 | case .iPadMini, .iPadMini2, .iPadMini3, .iPadMini4, .iPadMini5: 208 | return .screen7_9Inch 209 | case .iPadPro10_5Inch: 210 | return .screen10_5Inch 211 | default: 212 | return .screen9_7Inch 213 | } 214 | case 1080: 215 | return .screen10_2Inch 216 | case 1112: 217 | return .screen10_5Inch 218 | case 1133: 219 | return .screen8_3Inch 220 | case 1180: 221 | return .screen10_9Inch 222 | case 1194, 1210: 223 | return .screen11Inch 224 | case 1366: 225 | return .screen12_9Inch 226 | case 1376: 227 | return .screen13Inch 228 | default: 229 | return .unknownSize 230 | } 231 | } 232 | 233 | static public func type(detectSimulator: Bool = false) -> Type { 234 | return getType(code: getVersionCode(detectSimulator: detectSimulator), detectSimulator: detectSimulator) 235 | } 236 | 237 | @available(*, deprecated, message: "use == operator instead") 238 | static public func isEqualToScreenSize(_ size: Size) -> Bool { 239 | return size == self.size() ? true : false; 240 | } 241 | 242 | @available(*, deprecated, message: "use > operator instead") 243 | static public func isLargerThanScreenSize(_ size: Size) -> Bool { 244 | return size.rawValue < self.size().rawValue ? true : false; 245 | } 246 | 247 | @available(*, deprecated, message: "use < operator instead") 248 | static public func isSmallerThanScreenSize(_ size: Size) -> Bool { 249 | return size.rawValue > self.size().rawValue ? true : false; 250 | } 251 | 252 | static public func isRetina() -> Bool { 253 | return UIScreen.main.scale > 1.0 254 | } 255 | 256 | static public func isPad(detectSimulator: Bool = true) -> Bool { 257 | return type(detectSimulator: detectSimulator) == .iPad 258 | } 259 | 260 | static public func isPod(detectSimulator: Bool = true) -> Bool { 261 | return type() == .iPod 262 | } 263 | 264 | static public func isSimulator() -> Bool { 265 | return type() == .simulator 266 | } 267 | 268 | } 269 | 270 | // MARK: - Dynamic island 271 | extension Device { 272 | static public var hasDynamicIsland: Bool { 273 | switch version(detectSimulator: true) { 274 | case .iPhone14Pro, 275 | .iPhone14Pro_Max, 276 | .iPhone15, 277 | .iPhone15Plus, 278 | .iPhone15Pro, 279 | .iPhone15Pro_Max, 280 | .iPhone16, 281 | .iPhone16Plus, 282 | .iPhone16Pro, 283 | .iPhone16Pro_Max: 284 | return true 285 | default: 286 | return false 287 | } 288 | } 289 | } 290 | 291 | #endif 292 | -------------------------------------------------------------------------------- /Source/macOS/DeviceMacOS.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DeviceMacOS.swift 3 | // Device 4 | // 5 | // Created by Tom Baranes on 16/08/16. 6 | // Copyright © 2016 Ekhoo. All rights reserved. 7 | // 8 | 9 | #if os(OSX) 10 | import Cocoa 11 | 12 | public class Device { 13 | static private func getVersionCode() -> String { 14 | var size : Int = 0 15 | sysctlbyname("hw.model", nil, &size, nil, 0) 16 | var model = [CChar](repeating: 0, count: Int(size)) 17 | sysctlbyname("hw.model", &model, &size, nil, 0) 18 | return String.init(validatingUTF8: model) ?? "" 19 | } 20 | 21 | static private func getType(code: String) -> Type { 22 | let versionCode = Device.getVersionCode() 23 | if versionCode.hasPrefix("MacPro") { 24 | return Type.macPro 25 | } else if versionCode.hasPrefix("iMac") { 26 | return Type.iMac 27 | } else if versionCode.hasPrefix("MacBookPro") { 28 | return Type.macBookPro 29 | } else if versionCode.hasPrefix("MacBookAir") { 30 | return Type.macBookAir 31 | } else if versionCode.hasPrefix("MacBook") { 32 | return Type.macBook 33 | } else if versionCode.hasPrefix("MacMini") { 34 | return Type.macMini 35 | } else if versionCode.hasPrefix("Xserve") { 36 | return Type.xserve 37 | } 38 | return Type.unknown 39 | } 40 | 41 | private static func sizeInInches() -> CGFloat { 42 | let screen = NSScreen.main 43 | let description = screen?.deviceDescription 44 | let displayPhysicalSize = CGDisplayScreenSize(description?[NSDeviceDescriptionKey(rawValue: "NSScreenNumber")] as? CGDirectDisplayID ?? 0) 45 | return floor(sqrt(pow(displayPhysicalSize.width, 2) + pow(displayPhysicalSize.height, 2)) * 0.0393701); 46 | } 47 | 48 | static public func size() -> Size { 49 | let sizeInInches = Device.sizeInInches() 50 | 51 | switch sizeInInches { 52 | case 11: 53 | return Size.screen11Inch 54 | case 12: 55 | return Size.screen12Inch 56 | case 13: 57 | return Size.screen13Inch 58 | case 15: 59 | return Size.screen15Inch 60 | case 16: 61 | return Size.screen16Inch 62 | case 17: 63 | return Size.screen17Inch 64 | case 20: 65 | return Size.screen20Inch 66 | case 21: 67 | return Size.screen21_5Inch 68 | case 24: 69 | return Size.screen24Inch 70 | case 27: 71 | return Size.screen27Inch 72 | default: 73 | return Size.unknownSize 74 | } 75 | } 76 | 77 | static public func version() -> String { 78 | return String(describing: Device.type()) + " " + String(describing: Device.sizeInInches()) + "-inch" 79 | } 80 | 81 | static public func type() -> Type { 82 | let versionName = Device.getVersionCode() 83 | return Device.getType(code: versionName) 84 | } 85 | 86 | } 87 | #endif 88 | --------------------------------------------------------------------------------