I want to get the selected item from a Picker to update some data on the Firebase Database, but when i use the onTapGesture is not working
Note: The items inside the picker are Strings
My Code:
Picker(selection: $numUnitIndex, label: Text("Numerical Unit: \(numUnit)")) {
ForEach(0 ..< units.count) {
Text(self.units[$0]).tag($0).foregroundColor(.blue)
.onTapGesture {
//updateUnit(newUnit: self.units[numUnitIndex])
print("selected \(numUnitIndex)")
}
}
}.pickerStyle(MenuPickerStyle())