<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: 11.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIGestureRecognizer/name",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIGestureRecognizer(py)name"
  },
  "title" : "name"
}
-->

# name

The unique name of the gesture recognizer.

```
var name: String? { get set }
```

## Discussion

Assign a string to this property that uniquely identifies the gesture recognizer. Use this name to distinguish one gesture recognizer from another during debugging, or to specify a relationship between gestures in SwiftUI and UIKit.

For example, you can assign a SwiftUI gesture a name when you create it using <doc://com.apple.documentation/documentation/SwiftUI/View/gesture(_:name:isEnabled:)>, as the following code shows:

```swift
// SwiftUI code
struct TapGestureView: View {
    @State private var tapLocation: CGPoint = .zero

    var tap: some Gesture {
        DragGesture(minimumDistance: 0, coordinateSpace: .local)
            .onEnded { event in
                tapLocation = event.location
            }
    }

    var body: some View {
        Text("Tap location: \(tapLocation.debugDescription)")
            .frame(width: 120, height: 120)
            .background(Color.gray)
            .gesture(tap, name: "MyTap")
    }
}
```

Then, you can use this [`name`](/documentation/UIKit/UIGestureRecognizer/name) property to refer to the gesture from UIKit. For example, you might do this in your implementation of [`gestureRecognizer(_:shouldRequireFailureOf:)`](/documentation/UIKit/UIGestureRecognizerDelegate/gestureRecognizer(_:shouldRequireFailureOf:)), as the following code shows:

```swift
// UIKit code
class ViewController: UIViewController, UIGestureRecognizerDelegate {  
 
    func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, 
        shouldRequireFailureOf other: UIGestureRecognizer) -> Bool {
        return other.name == "MyTap"
    }

    // ...
}
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)