<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "TouchController",
  "identifier" : "/documentation/TouchController/TCTouchController",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Touch Controller"
    ],
    "preciseIdentifier" : "c:objc(cs)TCTouchController"
  },
  "title" : "TCTouchController"
}
-->

# TCTouchController

An object that allows you to create and customize on-screen touch controls for a game that uses Metal.

```
class TCTouchController
```

## Overview

The controller exposes controls through a <doc://com.apple.documentation/documentation/GameController/GCController>
instance, and enables seamless integration with the <doc://com.apple.documentation/documentation/GameController>
framework.

This class manages the lifecycle of touch controls, handles user interaction, renders the controls using Metal,
and provides a `GCController` instance that reflects the state of the on-screen controls.

## Topics

### Creating a touch controller

[`init(descriptor: TCTouchControllerDescriptor)`](/documentation/TouchController/TCTouchController/init(descriptor:))

Creates a new instance with the provided descriptor.

[`class TCTouchControllerDescriptor`](/documentation/TouchController/TCTouchControllerDescriptor)

A descriptor for configuring a touch controller.

### Inspecting the touch controller

[`var buttons: [TCButton]`](/documentation/TouchController/TCTouchController/buttons)

An array containing all the button controls managed by this controller.

[`var controls: [any TCControl]`](/documentation/TouchController/TCTouchController/controls)

An array containing all the touch controls managed by this controller.

[`var device: any MTLDevice`](/documentation/TouchController/TCTouchController/device)

The Metal device the touch control uses for rendering the touch controls.

[`var directionPads: [TCDirectionPad]`](/documentation/TouchController/TCTouchController/directionPads)

An array containing all the direction pad controls managed by this controller.

[`var drawableSize: CGSize`](/documentation/TouchController/TCTouchController/drawableSize)

The size of the drawable to which the touch controller’s contents be drawn, in native pixels.

[`var size: CGSize`](/documentation/TouchController/TCTouchController/size)

The size of the view the touch controller’s drawable is embedded in, in points.

[`var switches: [TCSwitch]`](/documentation/TouchController/TCTouchController/switches)

An array containing all the switch controls managed by this controller.

[`var isConnected: Bool`](/documentation/TouchController/TCTouchController/isConnected)

A Boolean value that indicates whether the touch controller is connected to the Game Controller framework.

[`class var isSupported: Bool`](/documentation/TouchController/TCTouchController/isSupported)

Whether touch controllers are supported for the device.

[`var throttles: [TCThrottle]`](/documentation/TouchController/TCTouchController/throttles)

An array containing all the throttle controls managed by this controller.

[`var thumbsticks: [TCThumbstick]`](/documentation/TouchController/TCTouchController/thumbsticks)

An array containing all the thumbstick controls managed by this controller.

[`var touchpads: [TCTouchpad]`](/documentation/TouchController/TCTouchController/touchpads)

An array containing all the touchpad controls managed by this controller.

### Getting the touch controller

[`var controller: GCController`](/documentation/TouchController/TCTouchController/controller)

The game controller instance associated with this touch controller.

### Adding a button control

[`func addButton(descriptor: TCButtonDescriptor) -> TCButton`](/documentation/TouchController/TCTouchController/addButton(descriptor:))

Creates a new button control with the provided descriptor, and adds it to the touch controller.

[`class TCButtonDescriptor`](/documentation/TouchController/TCButtonDescriptor)

A descriptor for configuring a button.

### Adding a directional pad control

[`func addDirectionPad(descriptor: TCDirectionPadDescriptor) -> TCDirectionPad`](/documentation/TouchController/TCTouchController/addDirectionPad(descriptor:))

Creates a new direction pad control with the provided descriptor, and adds it to the touch controller.

[`class TCDirectionPadDescriptor`](/documentation/TouchController/TCDirectionPadDescriptor)

A descriptor for configuring a directional pad.

### Adding a switch control

[`func addSwitch(descriptor: TCSwitchDescriptor) -> TCSwitch`](/documentation/TouchController/TCTouchController/addSwitch(descriptor:))

Creates a new switch control with the provided descriptor, and adds it to the touch controller.

[`class TCSwitchDescriptor`](/documentation/TouchController/TCSwitchDescriptor)

A descriptor for configuring a switch.

### Adding a throttle control

[`func addThrottle(descriptor: TCThrottleDescriptor) -> TCThrottle`](/documentation/TouchController/TCTouchController/addThrottle(descriptor:))

Creates a new throttle control with the provided descriptor, and adds it to the touch controller.

[`class TCThrottleDescriptor`](/documentation/TouchController/TCThrottleDescriptor)

A descriptor for configuring a throttle.

### Adding a thumbstick control

[`func addThumbstick(descriptor: TCThumbstickDescriptor) -> TCThumbstick`](/documentation/TouchController/TCTouchController/addThumbstick(descriptor:))

Creates a new thumbstick control with the provided descriptor, and adds it to the touch controller.

[`class TCThumbstickDescriptor`](/documentation/TouchController/TCThumbstickDescriptor)

A descriptor for configuring a thumbstick.

### Adding a touchpad control

[`func addTouchpad(descriptor: TCTouchpadDescriptor) -> TCTouchpad`](/documentation/TouchController/TCTouchController/addTouchpad(descriptor:))

Creates a new touchpad control with the provided descriptor, and adds it to the touch controller.

[`class TCTouchpadDescriptor`](/documentation/TouchController/TCTouchpadDescriptor)

A descriptor for configuring a touchpad.

### Connecting and disconnecting a controller

[`func connect()`](/documentation/TouchController/TCTouchController/connect())

Connects the touch controller to the app, allowing its controls to be drawn and an associated `GCController` to be created.

[`func disconnect()`](/documentation/TouchController/TCTouchController/disconnect())

Disconnects the touch controller from the app, preventing its controls from being drawn.

### Getting the controller at a point

[`func control(at: CGPoint) -> (any TCControl)?`](/documentation/TouchController/TCTouchController/control(at:))

The control at the specified point, if any.

### Handling layout updates

[`func automaticallyLayoutControls(for: [TCControlLabel])`](/documentation/TouchController/TCTouchController/automaticallyLayoutControls(for:))

Automatically lays out the provided control labels, creating them if needed.

[`func render(using: any MTLRenderCommandEncoder)`](/documentation/TouchController/TCTouchController/render(using:))

Renders the touch controls using the provided Metal render command encoder.

### Handling a touch

[`func handleTouchBegan(at: CGPoint, index: Int) -> Bool`](/documentation/TouchController/TCTouchController/handleTouchBegan(at:index:))

Handles a touch began event at the specified point.

[`func handleTouchEnded(at: CGPoint, index: Int) -> Bool`](/documentation/TouchController/TCTouchController/handleTouchEnded(at:index:))

Handles a touch ended event at the specified point.

[`func handleTouchMoved(at: CGPoint, index: Int) -> Bool`](/documentation/TouchController/TCTouchController/handleTouchMoved(at:index:))

Handles a touch moved event at the specified point.

### Removing controls

[`func removeControl(any TCControl)`](/documentation/TouchController/TCTouchController/removeControl(_:))

Removes the control from the touch controller.

[`func removeAllControls()`](/documentation/TouchController/TCTouchController/removeAllControls())

Removes all controls from the touch controller.

### Getting the touch controller category

[`let TCGameControllerProductCategoryTouchController: String`](/documentation/TouchController/TCGameControllerProductCategoryTouchController)

## Relationships

### Conforms To

[`CVarArg`](/documentation/Swift/CVarArg)

[`Equatable`](/documentation/Swift/Equatable)

[`Hashable`](/documentation/Swift/Hashable)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

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)