DriverKit Communicating a SwiftUI APP

I read the example "Communicating Between a DriverKit Extension and a Client App". https://developer.apple.com/documentation/driverkit/communicating_between_a_driverkit_extension_and_a_client_app

But I still don't know, can I communicate with DriverKit through SwiftUI APP?

Instead of using IOServiceOpen in CppUserClient, can I use IOServiceOpen in SwiftUI APP like this?

Or are there other options?

Answered by in 688906022

Since IOServiceOpen is a part of IOKit, and IOKit is available in Swift, it is absolutely possible to connect to a DriverKit driver via a SwiftUI application. You can find the documentation for the Swift version of IOServiceOpen here: https://developer.apple.com/documentation/iokit/1514515-ioserviceopen.

Just remember that you will need specific entitlements to communicate with a dext, so either your SwiftUI app will need an extra entitlement, or your dext will need to allow all user clients with an entitlement.

Accepted Answer

Since IOServiceOpen is a part of IOKit, and IOKit is available in Swift, it is absolutely possible to connect to a DriverKit driver via a SwiftUI application. You can find the documentation for the Swift version of IOServiceOpen here: https://developer.apple.com/documentation/iokit/1514515-ioserviceopen.

Just remember that you will need specific entitlements to communicate with a dext, so either your SwiftUI app will need an extra entitlement, or your dext will need to allow all user clients with an entitlement.

DriverKit Communicating a SwiftUI APP
 
 
Q