我正在阅读Alamofire的源代码,在这个类SessionManager.swift中,我不知道这段代码是什么意思:委托[task] = request。在对象中,对象可以有[]操作吗?或者代表是字典?哦,这似乎是不可能的,所以我不知道如何使用这个代码,任何人都可以帮助我吗?非常感谢
open func request(_ urlRequest: URLRequestConvertible) -> DataRequest {
var originalRequest: URLRequest?
do {
originalRequest = try urlRequest.asURLRequest()
let originalTask = DataRequest.Requestable(urlRequest: originalRequest!)
let task = try originalTask.task(session: session, adapter: adapter, queue: queue)
let request = DataRequest(session: session, requestTask: .data(originalTask, task))
delegate[task] = request
if startRequestsImmediately {
request.resume()
}
return request
} catch {
return request(originalRequest, failedWith: error)
}
}