title: What is the best way to detect orientation in an app extension?
body: <p>What is the best way to detect a device's orientation in an application extension? I have had mixed results with solutions I've found on here:</p>
  
  <p><a href="https://stackoverflow.com/questions/24166878/how-to-detect-orientation-change-in-custom-keyboard-extension-in-ios-8">How to detect Orientation Change in Custom Keyboard Extension in iOS 8?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/25462091/get-device-current-orientation-app-extension">Get device current orientation (App Extension)</a></p>
  
  <p>I have looked at size classes and <code>UITraitCollection</code> and found that the device inaccurately reports that it is in portrait when it is in fact in landscape (not sure if this is OS bug, or I am not querying the right APIs the right way).</p>
  
  <p>What is the best method for accomplishing:</p>
  
  <ul>
  <li>The device's current orientation when the extension is first loaded</li>
  <li>The orientation the device will rotate to</li>
  <li>The orientation the device did rotate to</li>
  </ul>
  
  <p>Thank you,</p>