title: No such file or directory, NSFilePath=~/Library
body: <p>The below quoted error gets thrown when I run the following code snippet</p>
  
  <pre><code>fileManager.contentsOfDirectoryAtPath(libraryPath)
  </code></pre>
  
  <p>Error</p>
  
  <blockquote>
    <p>Error Domain=NSCocoaErrorDomain Code=260 "The operation couldn’t be
    completed. (Cocoa error 260.)" UserInfo=0x17585bf0
    {NSUnderlyingError=0x175706b0 "The operation couldn’t be completed. No
    such file or directory", NSFilePath=~/Library, NSUserStringVariant=(
        Folder )}</p>
  </blockquote>
  
  <p>Here is the complete code snippet that I used just in case if anybody wants to try</p>
  
  <pre><code>   func listLibDir(){
  
          let libraryPath = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.LibraryDirectory, NSSearchPathDomainMask.UserDomainMask, false).first!
  
          let fileManager: NSFileManager = NSFileManager.defaultManager()
  
          do{
              var directoryContent:Array&lt;String&gt; = try fileManager.contentsOfDirectoryAtPath(libraryPath)
  
              for fileName: String in directoryContent {
                  print("library:\(fileName)")
              }
          }
          catch{
              print(error)
          }
  
      }
  </code></pre>
  
  <p>If somebody can clarify why this error happens and suggest a solution then it'd be great</p>