A private framework is just a bundle like a public framework. You can load it explicitly with:
if let framework = Bundle(path: "/System/Library/PrivateFrameworks/BatteryCenter.framework") {
// Works only on real devices
framework.load()
}
But you need declarations for the included classes. You might create them with class-dump
as Objective C headers, and import the over a bridging header into Swift.
You execute class-dump
with class-dump /.../PrivateFrameworks/XXX.framework/XXX
. You need the framework as binary not as *.tbd
file. Example for BatteryCenter.framework
:
class-dump /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/BatteryCenter.framework/BatteryCenter
This will print you class declarations for all classes contained in the framework.
Note, on a device or a simulator you should use
/System/Library/PrivateFrameworks/BatteryCenter.framework
for loading the bundle.