Skip to content

Instantly share code, notes, and snippets.

@gjones
Last active June 12, 2017 01:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gjones/bbdc951b2d3cdd59d85ace66ffc7e4c1 to your computer and use it in GitHub Desktop.
Save gjones/bbdc951b2d3cdd59d85ace66ffc7e4c1 to your computer and use it in GitHub Desktop.
UIDevice extension to identify different type sizes of iPad. (Swift 3.x)
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