title: Library directory in iOS using Swift
body: <p>I'm very confused. I want to store few user files, but not docs. I'm using:</p>
  
  <pre><code>static var directory: URL {
      get { 
         return FileManager.default.urls(for: .libraryDirectory, in: .userDomainMask)[0].appendingPathComponent("Caches").appendingPathComponent("OnlineFiles") 
      }
  }
  </code></pre>
  
  <p>Always the same. Every time I launch the app I get different URL.
  Am I doing something wrong? Is there some magic switch in project file which I need to set?</p>
  
  <p>Once it's something like:</p>
  
  <blockquote>
    <p>file:///var/mobile/Containers/Data/Application/4547EF22-EB33-4B65-9772-67ED7870E3E9/Library/Caches/OnlineFiles</p>
  </blockquote>
  
  <p>Other time it's:</p>
  
  <blockquote>
    <p>file:///var/mobile/Containers/Data/Application/83C8CDD7-B4D0-48B2-8A8E-9BD48C5D1754/Library/Caches/OnlineFiles</p>
  </blockquote>
  
  <p>This string between /Application/ and /Library/ seems to be random. How to store files in one location when I can access them later when opening app second time?</p>
  
  <p>[EDIT]: how to get path which is not changed every time I update app?</p>