You absolutely can do this. You can set the value directly on an NSMutableURLRequest
which can be passed into Alamofire.
let URL = NSURL(string: "https://httpbin.org/get")!
let mutableURLRequest = NSMutableURLRequest(URL: URL)
mutableURLRequest.timeoutInterval = 5.0
Alamofire.request(mutableURLRequest)
.responseJSON { response in
debugPrint(response)
}
UPDATE
You cannot control the timeoutIntervalForResource
per request. The timeout interval property on NSURLRequest
is equivalent to timeoutIntervalForRequest
on the NSURLSessionConfiguration
. More details here.