title: Get image file type programmatically in swift
body: <p>I am downloading images from parse with file totes PNG and JPEG.</p>
  
  <p>When image is downloaded to the app I need to determine what the file type is so I can handle image accordingly.</p>
  
  <p>Had a look at API for uiimageview and did a search but can't find any solution in swift.</p>
  
  <p>Any input appreciated </p>
  
  <p>Trying to get url from PFFIle §:</p>
  
  <pre><code>let imageURLFromParse = NSURL(string : caseImageFile2.url);
  
  // Error here: 'NSURL?' does not have a member named 'pathExtension'                   
  if(imageURLFromParse.pathExtension!.lowercaseString == ".jpg" || imageURLFromParse.pathExtension.lowercaseString == ".jpeg"){
  
    println("Parse image ext is a jpg: \(imageURLFromParse.pathExtension.lowercaseString)");
  
    fileExtenion = ".jpg";
  
  } else {                        
    println("Parse image is a png: \(imageURLFromParse.pathExtension.lowercaseString)");
  
    fileExtenion = ".png";                           
  }
  </code></pre>