title: Download file from server using Swift
body: <p>Hi I have a whole bunch of .mp3 files I want to use with NSFileManager and store in the documents folder. Is there a way I can download the .mp3 files online and then have it save to the documents folder? This is what I'm using for a local file. </p>
  
  <pre><code>let filemanager = NSFileManager.defaultManager()
  let documentsPath : AnyObject = NSSearchPathForDirectoriesInDomains(.DocumentDirectory,.UserDomainMask,true)[0]
  let destinationPath:NSString = documentsPath.stringByAppendingString("/Attention.mp3")
  
  if (!filemanager.fileExistsAtPath(destinationPath)) {
    var theError: NSError?
    let fileForCopy = NSBundle.mainBundle().pathForResource("Attention",ofType:"mp3")
    filemanager.copyItemAtPath(fileForCopy!,toPath:destinationPath, error: &amp;theError)
  
    if (theError == nil) {
      println("The music files has been saved.")
    } else {
      println("Error")
    }
  } else {
    println("The files already exist")
  }
  </code></pre>