title: Deleting contents of text file
body: <p>I'm reading and writing to a text file. There is an instance where I want to delete the contents of the file (but not the file) as a kind of reset. How can I do this?</p>
  
  <pre><code>if ((dirs) != nil) {
      var dir = dirs![0]; //documents directory
  
      let path = dir.stringByAppendingPathComponent("UserInfo.txt");
      println(path)
      let text = "Rondom Text"
  
      //writing
      text.writeToFile(path, atomically: false, encoding: NSUTF8StringEncoding, error: nil)
  
      //reading
      let text2 = String(contentsOfFile: path, encoding: NSUTF8StringEncoding, error: nil)
  
      println(text2)
  </code></pre>