title: iOS: UIImagePNGRepresentation().writeToFile not writing to intended directory
body: <p>Using <code>Swift</code> I am trying to download a <code>JPG</code> from a URL and then saving that image to a file, but when I try to save it to a different directory it won't. It will download to the app's <code>Documents</code> folder, but not when I try to set the path to another subfolder.</p>
  
  <pre><code>let dir = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0].stringByAppendingPathComponent("SubDirectory") as String
  let filepath = dir.stringByAppendingPathComponent("test.jpg")
  UIImagePNGRepresentation(UIImage(data: data)).writeToFile(filepath, atomically: true)
  </code></pre>
  
  <p>When I run this, it doesn't save the image to it? Why is this happening? Do I need to create the subfolder beforehand?</p>