The IOKit framework is not modularised, so you can’t import it directly from Swift. You can import it from a C-base language:
#include <IOKit/IOKitLib.h>
You have a couple of options on the Swift side:
-
Create Objective-C classes that implement the functionality you need on top I/O Kit, and then call those from Swift.
-
Import I/O Kit in a bridging header and call it directly from Swift.
I’ve done both and, honestly, I’m not sure which one I prefer (-:
Note The above is is no different from the story on macOS.
Keep in mind that I/O Kit on iPadOS is there so folks can talk to DriverKit drivers; it’s not the general-purpose ‘do everything’ API that you have on macOS.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"