Skip to content

Super-lightweight library to detect used device

License

Notifications You must be signed in to change notification settings

splitwise/Device.swift

 
 

Repository files navigation

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")
}

About

Super-lightweight library to detect used device

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 98.0%
  • Objective-C 2.0%