mirror of
https://github.com/Toxblh/MTMR.git
synced 2026-01-10 17:08:39 +00:00
remove force cast
This commit is contained in:
parent
e62530d7ab
commit
61d5e8f77e
@ -75,34 +75,28 @@ class BatteryInfo: NSObject {
|
|||||||
|
|
||||||
for ps in psList {
|
for ps in psList {
|
||||||
if let psDesc = IOPSGetPowerSourceDescription(psInfo, ps).takeUnretainedValue() as? [String: Any] {
|
if let psDesc = IOPSGetPowerSourceDescription(psInfo, ps).takeUnretainedValue() as? [String: Any] {
|
||||||
let current = psDesc[kIOPSCurrentCapacityKey]
|
if let current = psDesc[kIOPSCurrentCapacityKey] as? Int {
|
||||||
if current != nil {
|
self.current = current
|
||||||
self.current = current as! Int
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let timeToEmpty = psDesc[kIOPSTimeToEmptyKey]
|
if let timeToEmpty = psDesc[kIOPSTimeToEmptyKey] as? Int {
|
||||||
if timeToEmpty != nil {
|
self.timeToEmpty = timeToEmpty
|
||||||
self.timeToEmpty = timeToEmpty as! Int
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let timeToFull = psDesc[kIOPSTimeToFullChargeKey]
|
if let timeToFull = psDesc[kIOPSTimeToFullChargeKey] as? Int {
|
||||||
if timeToFull != nil {
|
self.timeToFull = timeToFull
|
||||||
self.timeToFull = timeToFull as! Int
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let isCharged = psDesc[kIOPSIsChargedKey]
|
if let isCharged = psDesc[kIOPSIsChargedKey] as? Bool {
|
||||||
if isCharged != nil {
|
self.isCharged = isCharged
|
||||||
self.isCharged = isCharged as! Bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let isCharging = psDesc[kIOPSIsChargingKey]
|
if let isCharging = psDesc[kIOPSIsChargingKey] as? Bool {
|
||||||
if isCharging != nil {
|
self.isCharging = isCharging
|
||||||
self.isCharging = isCharging as! Bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let ACPower = psDesc[kIOPSPowerSourceStateKey]
|
if let ACPower = psDesc[kIOPSPowerSourceStateKey] as? String {
|
||||||
if ACPower != nil {
|
self.ACPower = ACPower
|
||||||
self.ACPower = ACPower as! String
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user