A control element measuring a button press.


class GCControllerButtonInput : GCControllerElement


A button element can either be analog or digital.


Reading the Button’s Value

var isPressed: Bool

A Boolean value that indicates whether the button is pressed.

var value: Float

The level of pressure being applied to the button.

Receiving Notifications When the Button’s Value Changes

var pressedChangedHandler: GCControllerButtonValueChangedHandler?

A handler to be called when the button is pressed or released.

var valueChangedHandler: GCControllerButtonValueChangedHandler?

A handler to be called when the pressure on a button changes.


typealias GCControllerButtonValueChangedHandler

Signature for the block executed if a button changes values.

Instance Methods


Inherits From

Conforms To

See Also

Input Elements

class GCControllerElement

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

class GCControllerAxisInput

A control element measuring movement along a particular axis.

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