title: Get focal length of iOS devices
body: <p>In Swift, is there an easy way to find the focal length of the currently using camera?
  I am working on an iOS application and I need to use the focal length (in pixels or in mm) of iOS cameras. I found documentation from Apple about the focal length, but there is no information about how to obtain it. Here are two places I have visited:</p>
  
  <ul>
  <li><a href="https://developer.apple.com/documentation/modelio/mdlcamera/1392015-focallength" rel="nofollow noreferrer">mdlcamera</a> </li>
  <li><a href="https://developer.apple.com/documentation/coreimage/cidetectorfocallength" rel="nofollow noreferrer">coreimage</a></li>
  </ul>
  
  <p>I have also checked <a href="https://stackoverflow.com/questions/13190932/how-to-find-out-focal-length-of-camera-in-ios-and-what-is-the-sensor-height">this question</a> but it doesn't seem to solve my problem.
  I know that the focal length can be calculated using the Field of View as follows:</p>
  
  <pre><code>focal_length_pixels = (image_diagonal_pixels/2)/tan(FOV/2)
  </code></pre>
  
  <p>but again, there are no guides in computing that quantity.</p>
  
  <p>Could you please help?
  Thanks.</p>