private func showResults(_ results: [(label: String, confidence:
Float)]?) {
var resultsText = Constants.failedToDetectObjectsMessage
if let results = results {
resultsText = results.reduce("") { (resultString, result) ->
String in
let (label, confidence) = result
return resultString + "\(label): \(String(describing:
confidence))\n"
}
}
resultsAlertController.message = resultsText
resultsAlertController.popoverPresentationController?.sourceRect = self.annotationOverlayView.frame
resultsAlertController.popoverPresentationController?.sourceView = self.annotationOverlayView
present(resultsAlertController, animated: true, completion: nil)
print(resultsText)
}
这是我尝试过的示例代码。如何提取具有最高置信度值的标签并将其打印出来?