title: Detecting if Mac has a backlit keyboard
body: <p>It’s quite easy to detect if Mac has an illuminated keyboard with <code>ioreg</code> at the command line:</p>
  <pre><code>ioreg -c IOResources -d 3 | grep '&quot;KeyboardBacklight&quot; =' | sed 's/^.*= //g'
  </code></pre>
  <p>But how can I programmatically get this <code>IOKit</code> boolean property using the latest Swift? I’m looking for some sample code.</p>