2

I'm trying to work with gamepads, so I'd like to start by listing all the HIDs connected to my machine.

Apple's documentation has code samples which no longer work, so I thought I'd recreate it.

Following that documentation, I've attempted to create an IOHIDManager, but it does not autocomplete in and I get the error "Use of Unresolved Identifier".

import IOKit
//...
let x = IOHIDManager // does not exist

Is it possible to list HIDs using Swift, or must I write these portions in Obj-C?

SimplGy
  • 20,079
  • 15
  • 107
  • 144
  • 1
    Add `import IOKit.hid` (found here: https://forums.developer.apple.com/thread/6077) – Martin R Nov 14 '16 at 19:25
  • 1
    Adding `IOKit.hid` won't work. As said on the link you provided, it says "You can get the headers/declarations into a Swift playground using (...) But it will just result in a runtime error". You will have to use Objective-C to achieve your goal. – richerlariviere Apr 16 '17 at 20:02

0 Answers0