---
title: "handlesGameControllerEvents(matching:withOptions:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/handlesgamecontrollerevents(matching:withoptions:)"
---

# handlesGameControllerEvents(matching:withOptions:)

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

## Declaration

```swift
nonisolated func handlesGameControllerEvents(matching types: GCUIEventTypes, withOptions options: GameControllerEventHandlingOptions?) -> some View

```

## Discussion

Discussion SpriteView(scene: MyGameScene()) .handlesGameControllerEvents(matching: .gamepad, withOptions: .defaultOptions) .focused(true)

## See Also

### Game controller

- [handlesGameControllerEvents(matching:)](swiftui/view/handlesgamecontrollerevents(matching:).md)
