【发布时间】:2018-03-03 01:22:26
【问题描述】:
我试图在保护语句中调用一个名为“nextPage”的函数,但它说“()”不能转换为“Bool”。我需要做什么才能调用此函数
@IBAction func nextPressed(_ sender: Any) {
let geoCoder = CLGeocoder()
geoCoder.geocodeAddressString(address) { (placemarks, error) in
guard
let placemark = placemarks?.first,
let latVar = placemark.location?.coordinate.latitude,
let lonVar = placemark.location?.coordinate.longitude,
nextPage() // Error - '()' is not convertible to 'Bool'
else {
print("no location found")
return
}
}
}
【问题讨论】:
标签: swift function methods guard-statement