<!--
{
  "availability" : [
    "macOS: 10.10.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSPanGestureRecognizer/setTranslation(_:in:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSPanGestureRecognizer(im)setTranslation:inView:"
  },
  "title" : "setTranslation(_:in:)"
}
-->

# setTranslation(_:in:)

Changes the current translation value of the gesture recognizer.

```
func setTranslation(_ translation: NSPoint, in view: NSView?)
```

## Parameters

`translation`

The new translation values to use in the gesture recognizer.

`view`

The view in whose coordinate system you specified the new translation value. Specifying `nil` resets the previous translation value.

## Discussion

This method changes the current translation value of the gesture recognizer. Changing the value resets the velocity of the pan. You might call this method at mouse-down time to adjust the translation value and make it relative to some specific point in your view.

---

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)