Skip to content

Latest commit

 

History

History
39 lines (26 loc) · 764 Bytes

README.md

File metadata and controls

39 lines (26 loc) · 764 Bytes

Device.swift

[Platform][cocoapod-url]

Super-lightweight library to detect used device

Device.swift extends the UIDevice class by adding a property:

var deviceType: DeviceType

Install

Swift Package Manager

Add the following to your Package.swift file:

dependencies: [
    .package(url: "https://github.com/splitwise/device.swift", from: "1.2.3")
]

Usage

import Device

let deviceType = UIDevice.current.deviceType

switch deviceType {
  case .iPhone6SPlus: print("Do stuff for iPhone6S Plus")
  case .iPadMini: print("Do stuff for iPad mini")
  default: print("Check other available cases of DeviceType")
}