title: UIDocumentInteractionController() swift
body: <p>I created a file and I want to share it via <code>UIDocumentInteractionController</code>.</p>
  <p>I am unsure on how to obtain the URL from the <code>documentsPath</code> and destination path where I saved my file</p>
  <pre><code>        let someText = NSString(string: &quot;Test&quot;)
          let documentsPath = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0] as String
  
          let destinationPath = documentsPath.stringByAppendingPathComponent(&quot;Data.txt&quot;)
          var error:NSError?
          
          let written = someText.writeToFile(destinationPath,
              atomically: true,
              encoding: NSUTF8StringEncoding,
              error: &amp;error)
          
          if written{
              println(&quot;Successfully stored the file at path \(destinationPath)&quot;)
  
    let dic = UIDocumentInteractionController()
  
     self.dic.URL = url
              let v = sender as UIView
              let ok = self.dic.presentOpenInMenuFromRect(
                  v.bounds, inView: v, animated: true)
              
  </code></pre>