title: SwiftUI: Add ClearButton to TextField
body: <p>I am trying to add a ClearButton to TextField in SwiftUI when the particular TextField is selected.</p>
  
  <p>The closest I got was creating a <code>ClearButton</code> <code>ViewModifier</code> and adding it to the <code>TextField</code> using <code>.modifer()</code></p>
  
  <p>The only problem is <code>ClearButton</code> is permanent and does not disappear when <code>TextField</code> is deselected</p>
  
  <pre><code>TextField("Some Text" , text: $someBinding).modifier(ClearButton(text: $someBinding))
  
  struct ClearButton: ViewModifier {
      @Binding var text: String
  
      public func body(content: Content) -&gt; some View {
          HStack {
              content
              Button(action: {
                  self.text = ""
              }) {
                  Image(systemName: "multiply.circle.fill")
                      .foregroundColor(.secondary)
              }
          }
      }
  }
  </code></pre>