Hi Cuxdev
This is sort of a yes and no answer really. First take into consideration that I'm not a accomplished programmer but here's what I found.
The import IOKit.hid seems to (as far as auto complete in your code) work as long as the class does not subclass from say NSObject eg
class hid : NSObject {
}
would only give IOHIDButtonModes as an auto complete option in your code but nothing else starting with IOHID...
class hid {
}
Works fine (for Xcode to auto complete)
However there are a couple of issues I hit. First most things need a takeRetainValue() adding and other ARC friendly additives eg
let hidManager : IOHIDManagerRef = IOHIDManagerCreate(kCFAllocatorDefault, 0).takeRetainedValue()
Also as you can see from above if using HIDkeys the things like HIDOption types didn't work (for me) so in the above were you may have had
IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone)
in ObjC I had to place the actual int. Not a Major issue but finding these things out was a major pain in the butt
I then had all sorts of issues with the call backs eg
IOHIDManagerRegisterDeviceMatchingCallback(hidManager, &Handle_DeviceMatchingCallback, self);
Xcode errors in it's usual cryptic way. In the end I gave in and left the my code in objective C. (This had been an exercise in seeing if I could convert an old app to Swift).
Now don't get me wrong there's a lot of things I like about Swift especially as I came to ObjC from PHP and Swift is more PHP like but for anything that uses IOKit I'd stick with ObjC until Apple creates a pure swift/arc version of IOKit. But in honesty I'm not sure they will.
Cheers
Steve