Last active
June 12, 2017 01:12
-
-
Save gjones/bbdc951b2d3cdd59d85ace66ffc7e4c1 to your computer and use it in GitHub Desktop.
UIDevice extension to identify different type sizes of iPad. (Swift 3.x)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
extension UIDevice { | |
public var isiPadPro12: Bool { | |
if UIDevice.current.userInterfaceIdiom == UIUserInterfaceIdiom.pad | |
&& (UIScreen.main.bounds.size.height == 1366 || UIScreen.main.bounds.size.width == 1366) { | |
return true | |
} | |
return false | |
} | |
public var isiPadPro10: Bool { | |
if UIDevice.current.userInterfaceIdiom == UIUserInterfaceIdiom.pad | |
&& (UIScreen.main.bounds.size.height == 1112 || UIScreen.main.bounds.size.width == 1112) { | |
return true | |
} | |
return false | |
} | |
} | |
// Call with UIDevice.current.isiPadPro12 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment