title: How to get All Extensions for UTType Image, Audio, and Video
body: <p>Is there a way to get <a href="https://developer.apple.com/library/archive/documentation/Miscellaneous/Reference/UTIRef/Articles/System-DeclaredUniformTypeIdentifiers.html#//apple_ref/doc/uid/TP40009259-SW1" rel="nofollow noreferrer">All</a> of the <a href="https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/understanding_utis/understand_utis_conc/understand_utis_conc.html#//apple_ref/doc/uid/TP40001319-CH202-CHDHIJDE" rel="nofollow noreferrer">different</a> UTType extension types as Strings? I need them specifically for images, audio, and video.</p>
  <p>I followed <a href="https://stackoverflow.com/a/60606339/4833705">this answer</a>, but it doesn't give me all of the extensions</p>
  <pre><code>var types = [String]()
  
  let utiTypes = [kUTTypeImage, kUTTypeMovie, kUTTypeVideo, kUTTypeMP3, kUTTypeAudio, kUTTypeQuickTimeMovie, kUTTypeMPEG, kUTTypeMPEG2Video, kUTTypeMPEG2TransportStream, kUTTypeMPEG4, kUTTypeMPEG4Audio, kUTTypeAppleProtectedMPEG4Audio, kUTTypeAppleProtectedMPEG4Video, kUTTypeAVIMovie, kUTTypeAudioInterchangeFileFormat, kUTTypeWaveformAudio, kUTTypeMIDIAudio, kUTTypeLivePhoto, kUTTypeTIFF, kUTTypeGIF, kUTTypeQuickTimeImage, kUTTypeAppleICNS]
  
  for type in utiTypes {
              
      let str = String(type)
              
      guard let utiStr = fileExtension(for: str) else { continue }
  
      types.appent(utiStr)
  }
  
  dump(types)
  </code></pre>
  <p>The results are</p>
  <pre><code>15 elements // there are really 21 types
    - &quot;jpeg&quot;
    - &quot;png&quot;
    - &quot;mov&quot;
    - &quot;mpg&quot;
    - &quot;m2v&quot;
    - &quot;ts&quot;
    - &quot;mp3&quot;
    - &quot;mp4&quot;
    - &quot;mp4&quot;
    - &quot;avi&quot;
    - &quot;aiff&quot;
    - &quot;wav&quot;
    - &quot;midi&quot;
    - &quot;tiff&quot;
    - &quot;gif&quot;
  </code></pre>
  <p>The issue here is it doesn't return values like <code>qt</code> or <code>jpg</code>. For example I use the UIDocumentPickerViewController and when I select an image the returned url pathExtension is <code>jpg</code> not <code>jpeg</code>. If I wanted to know if the returned url was an image, and I compared its pathExtension to the <em>types</em> array above, it would say that it doesn't appear in the list.</p>