My problem is I'm not sure if a closure inside a class method can leads to memory leak. Here is my code
class func SomeDownloadFun (pdfDirectory:String) {
let destination : DownloadRequest.DownloadFileDestination = {
_, response in
//----------HERE I Reference the item 'pdfDirectory'-----Will this cause leak?
let fileURL = URL(fileURLWithPath: pdfDirectory)
return (fileURL,[.removePreviousFile,.createIntermediateDirectories])
}
let downLoadRequest = Alamofire.download(urlStr!, to: destination)
downLoadRequest.responseData(completionHandler: { (response) in
switch response.result {
case .success:
//----------HERE I Reference the item 'pdfDirectory'-----Will this cause leak?
print("pdfDirectory")
break
case .failure:
print("down err")
break
}
})
}
Aa I have comment out where i think it will cause a leak ,can anybody tell me ,Thanks!