Загрузить файл с помощью Alamofire 4.0 (Swift 3)
В более старой версии Alamofire. Вот так я скачиваю файл
let destinationPath = Alamofire.Request.suggestedDownloadDestination( directory: .documentDirectory, domain: .userDomainMask);
Alamofire.download(.GET, urlString, destination: destinationPath)
.progress { bytesRead, totalBytesRead, totalBytesExpectedToRead in
// print(totalBytesRead)
}
.response { request, response, _, error in
let downloadedFilePath = destinationPath(URL(string: "")!, response!);
NSUserDefaultsHelper.saveURL(downloadedFilePath, key: urlString);
completion(downloadedFilePath, true);
}
Но теперь в новой версии мой код полностью непригоден для использования, и в библиотеке Alamofire нет аналогичной функции.
Есть идеи, пожалуйста?