class APIClient {
var user = User()
let alamoFireManager : Alamofire.Manager?
let center = NSNotificationCenter.defaultCenter()
init(){
let con
init(){
let configuration = NSURLSessionConfiguration.defaultSessionConfiguration()
configuration.timeoutIntervalForResource = 4
configuration.timeoutIntervalForRequest = 4
self.alamoFireManager = Alamofire.Manager(configuration: configuration)
self.alamoFireManager!.request(.POST, CONSTANTS.APIEndpoint+"/test", parameters: parameters).responseJSON {
(req, res, json, error) in
if let json = self.handleAPIResponse(req, res: res, json_data: json, error: error){
}
}
}
Use self.alamoFireManager!.request in the same init function , timeout delay is only for the request not for the whole function. may be it can help.