Add a tag to your Text()
and remove Tap Gesture.
Text(data.name ?? "").tag(data.uid) //<-- Here
And use onReceive to listen to your selection
.onReceive(Just(selection)) { (_) in
print(selection)
}
Note: for this you need to import Combine
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…