Alex Broere
Alex Broere

Reputation: 1

Is it possible to over ride the UIDeviceBatteryState variable?

I'm wondering if it's possible to override var batteryState: UIDeviceBatteryState. For example, if the UIDeviceBatteryState is set to charging (i.e. charger is plugged in) would it be possible to disable the charging by changing it to unplugged?

Thanks in advance!

(Apple docs on UIDeviceBatteryState): https://developer.apple.com/documentation/uikit/uidevicebatterystate

Upvotes: 0

Views: 54

Answers (2)

kva
kva

Reputation: 74

var batteryState: UIDeviceBatteryState { get }

it is get only property so you can't set value

Upvotes: 0

creeperspeak
creeperspeak

Reputation: 5521

No, you can't override batteryState. It is even marked as { get } in the docs you linked. The closest thing you'd be able to do is to hide the status bar completely within your app.

Upvotes: 2

Related Questions