Framework

GameController

Support hardware game controller inputs. Discover connected controllers, connect new controllers to a device, and read the inputs of connected controllers.

Overview

The Game Controller framework, available in macOS and iOS, is used to receive inputs from game controllers inside your game.

Symbols

Classes

GCController

A GCController object represents a physical game controller that is communicating with the device. Controllers can be physically connected to the device or through a wireless connection.

GCControllerAxisInput

A GCControllerAxisInput element measures movement along a particular axis. An axis element is always an analog element.

GCControllerButtonInput

A GCControllerButtonInput element measures a button press. This element can either be analog or digital.

GCControllerDirectionPad

A GCControllerDirectionPad object represents a two-dimensional control such as a directional pad or a thumbstick. This element does not provide values of its own. Instead, its values are provided by its child elements. It provides two sets of children that map to the same physical controls, so your app can view the directional pad as either either a pair of axis elements (horizontal, vertical), or four button elements (up, down, left, right).

GCControllerElement

A GCControllerElement object represents a measurable value on a controller profile. Typically, elements are mapped to physical controls on a controller. When a player manipulates those controls, the element object’s values change. The GCControllerElement class is never instantiated directly. Instead, subclasses that represent the different kinds of elements are instantiated. Table 1 lists the supported element types.

GCEventViewController

A GCEventViewController object is a view controller that routes game controller input data through the operating system.

GCExtendedGamepad

A GCExtendedGamepad object implements a logical profile for a set of gamepad controls. A profile maps the hardware controls of a particular controller to a set of elements usable by your game.

GCExtendedGamepadSnapshot

A GCExtendedGamepadSnapshot object records all of the values from an extended gamepad profile at a particular moment in time. The snapshot is stored in a device independent format. You use snapshots when you need to record control information and use it later.

GCGamepad

A GCGamepad object implements a logical profile for a set of gamepad controls. A profile maps the hardware controls of a particular controller to a set of elements usable by your game.

GCGamepadSnapshot

A GCGamepadSnapshot object records all of the values from a gamepad profile at a particular moment in time. The snapshot is stored in a device independent format. You use snapshots when you need to record control information and use it later.

GCMicroGamepad

A GCMicroGamepad object implements a logical profile for a set of gamepad controls. A profile maps the hardware controls of a particular controller to a set of elements usable by your game. The micro gamepad profile is implemented only by the Apple TV Remote.

GCMicroGamepadSnapshot

A GCMicroGamepadSnapshot object records all of the values from a micro gamepad profile at a particular moment in time. The snapshot is stored in a device independent format. You use snapshots when you need to record control information and use it later.

GCMotion

A GCMotion object implements a logical profile that provides information about how a controller is oriented and how it is moving.

Extended Types

NSNotification.Name

The type used for the name of a notification.

See Also