I am trying to add a ClearButton to TextField in SwiftUI when the particular TextField is selected.
The closest I got was creating a ClearButton ViewM
ClearButton
ViewM
Not exactly what you're looking for, but this will let you show/hide the button based on the text contents:
text
HStack { if !text.isEmpty { Button(action: { self.text = "" }) { Image(systemName: "multiply.circle") } } }