A series of helpers and extensions for identifying what device is interacting with your app.
Get current device type (for use anywhere):
UIDevice.currentDevice().deviceTypeBoolean check for device type (for use anywhere):
if UIDevice.currentDevice().isIPhone {
// Do some iPhone related stuff...
}Boolean check for view size (for use in a view controller):
if isPhone6Size {
// Do some iPhone 6 size related stuff...
}Below is a list of device models that are recognized. Please note that testing on the simulator always outputs Simulator.
iPodTouch5
iPhone4
iPhone4s
iPhone5
iPhone5c
iPhone5s
iPhone6
iPhone6Plus
iPad2
iPad3
iPad4
iPadAir
iPadAir2
iPadMini
iPadMini2
iPadMini3
SimulatorUIDevice.currentDevice().deviceType -> DeviceType
UIDevice.currentDevice().isPortrait -> Bool
UIDevice.currentDevice().isLandscape -> Bool
UIDevice.currentDevice().isIPodTouch -> Bool
UIDevice.currentDevice().isIPhone -> Bool
UIDevice.currentDevice().isIPad -> Bool
UIDevice.currentDevice().isSimulator -> BoolFor brevity only showing examples for iPhone 6.
self.isIPhone6Size -> Bool
self.isIPhone6PortraitSize -> Bool
self.isIPhone6LandscapeSize -> Bool
self.iPhone6Dimensions -> [CGFloat]