The example for using Alamofire.download() works just fine, but there isn\'t any detail in how to access the resulting downloaded file. I can figure out where the file is and wh
Swift 2.1 and a little simpler:
var localPath: NSURL?
Alamofire.download(.GET,
"http://jplayer.org/video/m4v/Big_Buck_Bunny_Trailer.m4v",
destination: { (temporaryURL, response) in
let directoryURL = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)[0]
let pathComponent = response.suggestedFilename
localPath = directoryURL.URLByAppendingPathComponent(pathComponent!)
return localPath!
})
.response { (request, response, _, error) in
print(response)
print("Downloaded file to \(localPath!)")
}
)
Still hard to understand why they are using closures to set the destination path...