I'm trying to get a value received from an async closure and return it in a function with DispatchGroup however in the last part I get the error Cannot convert value of type 'String' to closure result type 'Void'
can anyone see the issue,
private func _pv(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String {
let dispatchGroup = DispatchGroup()
let dev = self.pickerDevices[row]
let id = dev.internalUUID
guard let name = dev.name
else {
return "\(id)"
}
dispatchGroup.enter()
dev.adData.getMachineName { (mName) in
print("machine name from wbmanager: \(mName)")
self.coffeeMachineName = mName
dispatchGroup.leave()
}
//Cannot convert value of type 'String' to closure result type 'Void'
dispatchGroup.notify(queue: DispatchQueue.main) {
return "\(name) \(self.coffeeMachineName)"
}
}