title: Swift - Storing data in directory using NSSearchPathForDirectoriesInDomains, but directory always changes?
body: <p>I have a sound recorder app where recorded sounds are stored like this:</p>
  
  <pre><code>let dirPath = NSSearchPathForDirectoriesInDomains(.DocumentDirectory,.UserDomainMask,true)[0] as String  
      var pathArray = [dirPath, recordingName]
      let filePath = NSURL.fileURLWithPathComponents(pathArray)
  </code></pre>
  
  <p>All file path URL's are stored in an array (put into NSUserDefaults) for easy access.</p>
  
  <p>I can play the files if they're played on the same run as when they're recorded, but opening and closing the simulator back up will result in the file path being wrong (since the app-id folder at ~/Library/Developer/CoreSimulator/Devices/Device-ID/data/Container/Data/Application/<strong>app-id-folder</strong>/Documents/filename.wav will have changed name). How can I change the array containing the file URL's to have the updated app-id folder name each time the app is run? (currently it's just an array of strings which are converted to NSURL type when necessary). Or even simpler, is it possible to save to the users home directory or somewhere where you don't need to deal with changing folder names?</p>