<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "visionOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/handlesGameControllerEvents(matching:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI",
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewP016_GameController_aB0E07handlesdE6Events8matchingQrSo14GCUIEventTypesV_tF"
  },
  "title" : "handlesGameControllerEvents(matching:)"
}
-->

# handlesGameControllerEvents(matching:)

Specifies the game controllers events which should be delivered through
the GameController framework when the view, or one of its descendants
has focus.

```
nonisolated func handlesGameControllerEvents(matching types: GCUIEventTypes) -> some View
```

## Discussion

```
SpriteView(scene: MyGameScene())
.handlesGameControllerEvents(matching: .gamepad)
.focused(true)
```

---

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)