【发布时间】:2018-12-23 12:51:03
【问题描述】:
我正在尝试使用 switch 语句获得布尔结果,但我猜我的代码有问题
class func login(username: String , password: String) -> Bool {
let url = "http://127.0.0.1:3000/login/"+username+"/"+password
Alamofire.request(url).responseJSON { response in
switch response.result {
case .failure:
// print(error)
return false
case .success:
// print(value)
return true
}
}
}
【问题讨论】: