title: Getting URL of UIImage from UIImagePickerController
body: <p>I'm trying to get the URL of an image imported from Library in Swift to send it to Apple Watch with <code>transferFile(_:metadata)</code> but I'm having two error on <code>NSURL</code>. </p>
  
  <p>This is my code: </p>
  
  <pre><code>func imagePickerController(picker: UIImagePickerController, didFinishPickingImage image: UIImage!, editingInfo: [NSObject : AnyObject]!)
  {
      imagePicked.image = image    
      let imageUrl = editingInfo[UIImagePickerControllerReferenceURL] as! NSURL
      let imageName = imageUrl.path!.lastPathComponent
      let documentDirectory = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true).first as String!
      let localPath = documentDirectory.stringByAppendingPathComponent(imageName)
      let image = editingInfo[UIImagePickerControllerOriginalImage]as! UIImage
      let data = UIImagePNGRepresentation(image)
  
      data!.writeToFile(localPath, atomically: true)
  
      let photoURL = NSURL(fileURLWithPath: localPath)
  
      self.dismissViewControllerAnimated(true, completion: nil);
  }
  </code></pre>
  
  <p>And I'm getting error with *imageName and *localPath because it says that:</p>
  
  <blockquote>
    <p>'lastPathComponent' is unavailable: Use lastPathComponent on NSURL instead.
    'stringByAppendingPathComponent' is unavailable: Use URLByAppendingPathComponent on NSURL instead.</p>
  </blockquote>
  
  <p>But I can't get it right in Swift 2.0 and Xcode 7. Where am I going wrong?</p>