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

# touches(matching:in:)

Returns the touch objects associated with the specified phase.

```
func touches(matching phase: NSTouch.Phase, in view: NSView?) -> Set<NSTouch>
```

## Parameters

`phase`

The touch phase for which you want touches.

`view`

The view for which touches are wanted. Touches that target this view, or any of the view’s descendants will be returned. Passing `nil` as the view gets all touches regardless of their targeted view.

## Return Value

A set of applicable [`NSTouch`](/documentation/AppKit/NSTouch) objects.

## Discussion

This method is only valid for gesture events (gesture, magnify, swipe, rotate, etc.).

---

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)