title: How can I detect when TextField is tapped? (SwiftUI on MacOS)
body: <p>How can I detect when a TextField is tapped? (SwiftUI on MacOS)</p>
  <pre><code>import SwiftUI
  
  struct ContentView: View {
    @State var field: String = &quot;TextField&quot;
    
    var body: some View {
      TextField(&quot;Fill in Text&quot;, text: $field)
        .onTapGesture {
          print(&quot;Textfield pressed&quot;)
      }
    }
  }
  </code></pre>
  <p>When the TextField is tapped it doesn't print &quot;Textfield pressed&quot;.
  I'm guessing this is because the tap is picked up by the TextField before it can be detected by the Textfield gesture.</p>