Needs update for Xcode 7.1 Swift 2.1
Add: default: self = .Unspecified
Change To: let batteryLevel = Double(round(100.0 * (UIDevice.currentDevice().batteryLevel * 100.0)) / 100.0) // rounded, with 2 digits precision
Hey :) Thanks! I've used a slightly different approach to make it compile, I've added a .TV case for the user interface idiom. So we get compiler errors if Apple adds new cases, if we used a default case those would silently misbehave. What do you think?
What is your experience with the battery level? I've just tried to get a value different from XX.0 but I'm unable ... even with your 100.0 ... I'm thinking about changing the Double to Int since it seems that it only returns integers (the UIDevice.currentDevice().batteryLevel returns only Doubles with 2 decimal places, e.g. 0.38 which is 38%). Please let me know what you experienced and think :) Thanks! 🙏
Resolved by commit 99cee4c2ff4a699919e5f089bb79af2d3617a332.