Can I add multiple DriverKit Extensions target to my macOS app? How to use OSSystemExtensionRequest to achieve it.
Add multiple DriverKit Extensions target to macOS app
You need to call OSSystermExtensionRequest.activationRequest() multiple times. This code fragment looks for a Resources/driverlist.json file and then loads the driver extensions defined there.
Sample driverlist.json file:
Code Block func _activate(_ bundleIdentifier: String) { let request = OSSystemExtensionRequest.activationRequest( forExtensionWithIdentifier: bundleIdentifier, queue: .main ) request.delegate = self OSSystemExtensionManager.shared.submitRequest(request) func activate( ) { let list = Bundle.main.decode("driverlist.json") for driver in list { _activate( driver.name) } }
Sample driverlist.json file:
[ { "name": "com.belcarra.driverkit" }]