title: Write file to documents directory and permissions
body: <p>I red the comments of this code example here:</p>
  
  <p><a href="https://www.hackingwithswift.com/example-code/strings/writetofile-how-to-save-a-string-to-a-file-on-disk" rel="noreferrer">https://www.hackingwithswift.com/example-code/strings/writetofile-how-to-save-a-string-to-a-file-on-disk</a></p>
  
  <pre><code>// failed to write file – bad permissions, bad filename, missing permissions, 
      or more likely it can't be converted to the encoding
  </code></pre>
  
  <p>I tried the code and it works on a device without requesting any permission. I couldn't find anything useful in the docs.</p>
  
  <p>So, my question is: what permissions (<em>bad</em> or <em>missing</em>) is the author talking about? Do I need special permissions to write to the app documents directory?</p>