title: swift video to document directory
body: <p>I need to save video captured with UIImagePicker to a custom folder in app document directory</p>
  
  <pre><code>func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {
      picker.dismissViewControllerAnimated(true, completion: nil)
      if let fileURL = info[UIImagePickerControllerMediaURL] as? NSURL {
          if let videoData = NSData(contentsOfURL: fileURL) {
              //save file to doc dir or save NSData into Core Data binary field
  
          }
      }
  }
  </code></pre>
  
  <p>alternatively I can save videoData in Core Data binary field with external storage but after I can't play the video with media player because I can't convert NSData to NSURL.</p>