Skip to content

Instantly share code, notes, and snippets.

View amiltoncamargo's full-sized avatar

Amilton Camargo amiltoncamargo

  • Atos
  • Brazil
View GitHub Profile
@amiltoncamargo
amiltoncamargo / ios_detect.swift
Created October 15, 2019 15:02 — forked from mahmudahsan/ios_detect.swift
iPhone X and other iOS device detection by Swift and Objective-C
struct Device {
// iDevice detection code
static let IS_IPAD = UIDevice.current.userInterfaceIdiom == .pad
static let IS_IPHONE = UIDevice.current.userInterfaceIdiom == .phone
static let IS_RETINA = UIScreen.main.scale >= 2.0
static let SCREEN_WIDTH = Int(UIScreen.main.bounds.size.width)
static let SCREEN_HEIGHT = Int(UIScreen.main.bounds.size.height)
static let SCREEN_MAX_LENGTH = Int( max(SCREEN_WIDTH, SCREEN_HEIGHT) )
static let SCREEN_MIN_LENGTH = Int( min(SCREEN_WIDTH, SCREEN_HEIGHT) )