Skip to content

Instantly share code, notes, and snippets.

@RSBOMB
RSBOMB / BatteryInfo.swift
Created March 14, 2019 09:14 — forked from JALsnipe/BatteryInfo.swift
Script to get iOS device battery info from the BatteryCenter private framework
import Foundation
guard case let batteryCenterHandle = dlopen("/System/Library/PrivateFrameworks/BatteryCenter.framework/BatteryCenter", RTLD_LAZY) where batteryCenterHandle != nil else {
fatalError("BatteryCenter not found")
}
guard let c = NSClassFromString("BCBatteryDeviceController") as? NSObjectProtocol else {
fatalError("BCBatteryDeviceController not found")
}