title: How to move a file in swift
body: <p>I'm trying to move a file to documents directory after I choose the file by using UIDocumentPickerViewController.</p>
  
  <p>I don't see any error, but the file doesn't move to the directory.</p>
  
  <p>I'd like to know how can I move the file.</p>
  
  <pre><code>class MyClassController: UIViewController,UIDocumentPickerDelegate {
  
   var thisURL:URL?   
  
    @IBAction func add(_ sender: Any) {
  
  
      let add = UIAlertAction(title: "add", style: .default, handler: {(alert: UIAlertAction!) in                         
            do {
  
              let myURL = URL(string:"\(self.thisURL!)")!
  
  
                     let path = try FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: true)
  
  
                  let MyDesPath = path.appendingPathComponent(myURL.lastPathComponent)
  
                              print(path)
                                  do {
                                  if FileManager.default.fileExists(atPath: “\(MyDesPath)") == false {
                                                                             try  FileManager.default.moveItem(at: myURL, to: URL(string:”\(MyDesPath)")!)
  
                                                                         }
                                                                         else {
  
                                                                         }
                                                                        }
                                                                          catch let error {
                                                                           print(error)
                                                                       }
  
                                                                             }
  
                                                                       catch let error{
                                                                           print(error)
                                                                           return
                                                                       }
  
      })
   func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) {
       NSLog("documentPicker executed")
      thisURL = urls[0]
  
      self.fileName.text = "\(thisURL!.lastPathComponent)"
  
  
      }
   }
  </code></pre>