title: Detect dark mode in XCUI test on real devices
body: <p>I'm trying to find a way to detect whether a phone is in dark mode or not in an XCUI test. So far I've got this:</p>
  <pre class="lang-swift prettyprint-override"><code>    private func darkMode() -&gt; Bool {
          if #available(iOS 13, *) {
              return UIView().traitCollection.userInterfaceStyle == .dark
          } else {
              return false
          }
      }
  </code></pre>
  <p>This works perfectly for simulators, but doesn't work for real devices. How can I achieve this for a real device?</p>
  <p>Note: I know there is a way to set dark/light mode in an XCUI test. I don't want this, I just want to detect it.</p>