How can I get IOBluetoothDevice's battery level, using Swift and AppKit (Xcode for MacOS) : <p>I am using <strong>Xcode</strong> to develop a <strong>MacOS app</strong>, based on <strong>Cocoa</strong> &amp; <strong>AppKit</strong>, written in <strong>Swift</strong>.</p>

<p>I am using <a href="https://developer.apple.com/documentation/iobluetooth/iobluetoothdevice" rel="noreferrer">IOBluetoothDevice</a> objects throughout my app, and I want to be able to display the devices' battery levels, if accessible.</p>

<p>I expect that devices which battery levels are visible on the OS's Bluetooth settings (see image below), to be also accessible programmatically (e.g., AirPods, Magic Keyboard, etc.). However, I could not find this anywhere.</p>

<p>I have also thought about executing a terminal command and found <a href="https://apple.stackexchange.com/questions/215256/check-the-battery-level-of-connected-bluetooth-headphones-from-the-command-line">this thread</a>, but it did also not work.</p>

<p>Thanks</p>

<p><a href="https://i.stack.imgur.com/TzlCd.png" rel="noreferrer"><img src="https://i.stack.imgur.com/TzlCd.png" alt="Bluetooth device battery level available to the OS"></a></p>
