let me = { (a:int,b:int) -> int in
return a + b
}
me(2,3)
========
override func viewDidLoad() {
super.viewDidLoad()
let para = ["a":"3","b":"4"] as [String : AnyObject]
NetworkTool.bbb( url:"http://wweqweqw", parameters : para ){ (topTitles) in
print(topTitles)
}
}
========
class NetworkTool: NetworkToolProtocol {
//test
class func bbb( url:String, parameters : [String : AnyObject], completionHandler:@escaping (_ topTitles: Any?)->()) {
print(parameters)
Alamofire.request(url, parameters: parameters).responseJSON { (response) in
guard response.result.isSuccess else {
return
}
if let value = response.result.value {
let json = JSON(value)
completionHandler(json)
}
}
}
}