📜  下载到文件 - 任何代码示例

📅  最后修改于: 2022-03-11 14:57:02.349000             🧑  作者: Mango

代码示例1
struct FileLoader {
    var session = URLSession.shared

    func downloadFile(from url: URL) async throws -> File {
        let (localURL, _) = try await session.download(from: url)
        return File(url: localURL)
    }
}