Alamofire.request(APPURL.GetAccounts, method: .post, parameters: transactionData, encoding: JSONEncoding.default, headers: nil).responseJSON { responseData in }
My question is, what is the reason that limits me only to the fact that I can use a dictionary like [String: Any]?
Code:
class func getAccounts( transactionData: [String:Any]?, withCompletionHandler: @escaping (_ response:AnyObject?)->(Void) ) { Alamofire.request(APPURL.GetAccounts, method: .post, parameters: transactionData, encoding: JSONEncoding.default, headers: nil).responseJSON { responseData in if((responseData.result.value) != nil) { let swiftyJsonVar = JSON(responseData.result.value!) if let resData = swiftyJsonVar["Accounts"].arrayObject { let resultData = resData as! [[String:AnyObject]] withCompletionHandler(resultData as AnyObject) }else{ withCompletionHandler(nil) } }else{ withCompletionHandler(nil) } } }
source share