Skip to content

Instantly share code, notes, and snippets.

@hcn1519
Created March 15, 2017 18:33
Show Gist options
  • Save hcn1519/4b61e7a2df00ddda7e92ee8c70e84660 to your computer and use it in GitHub Desktop.
Save hcn1519/4b61e7a2df00ddda7e92ee8c70e84660 to your computer and use it in GitHub Desktop.
// ScreenExtesion.swift
import UIKit
extension UIDevice {
public var isiPhoneSE: Bool {
if UIDevice.current.userInterfaceIdiom == UIUserInterfaceIdiom.phone && (UIScreen.main.bounds.size.height == 568 || UIScreen.main.bounds.size.width == 320) {
return true
}
return false
}
public var isiPhonePlus: Bool {
if UIDevice.current.userInterfaceIdiom == UIUserInterfaceIdiom.phone && (UIScreen.main.bounds.size.height == 736 || UIScreen.main.bounds.size.width == 414) {
return true
}
return false
}
public var isiPad: Bool {
if UIDevice.current.userInterfaceIdiom == UIUserInterfaceIdiom.pad && (UIScreen.main.bounds.size.height == 1024 || UIScreen.main.bounds.size.width == 768) {
return true
}
return false
}
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
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment