Device
is a value-type wrapper and extension of UIDevice
.
Swift 2.0
let device = Device()
print(device) // prints for example "iPhone 6 Plus"
if device == .iPhone6Plus {
// Do something
} else {
// Do something else
}
...
if device.batteryState == .Full || device.batteryState >= .Charging(75) {
print("Your battery is happy! 😊")
}
...
if device.batteryLevel >= 50 {
install_iOS()
} else {
showError()
}