An input associated with a physical control, such as a button or thumbstick.


class GCControllerElement : NSObject


Elements are mapped to physical controls on a controller. When a player manipulates a control, the corresponding element's values change. This class is never instantiated directly. Instead, subclasses represent different kinds of elements.

An element class usually represents an isolated element, such as a button, whose values can be read. However, an element can itself have child elements. For example, a direction pad is a two-dimensional control whose values can either be read as a pair of axis elements or four button elements. If an element is a child of another element, its collection property points to its parent element.

The isAnalog property determines whether the element returns a range of values or discrete (digital) values.


Inspecting Element Properties

var isAnalog: Bool

Returns a Boolean value that indicates whether the element provides analog data.

var collection: GCControllerElement?

Returns the element that this element is part of.


Inherits From

Conforms To

See Also

Input Elements

class GCControllerAxisInput

A control element measuring movement along a particular axis.

class GCControllerButtonInput

A control element measuring a button press.

class GCControllerDirectionPad

A control element associated with a directional pad or a thumbstick.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software