iOS Developer Library — Prerelease

Developer

Game Controller Framework Reference GCExtendedGamepadSnapshot Class Reference

Options
Deployment Target:

On This Page
Language:

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.

To create a gamepad snapshot, call the saveSnapshot method on a GCExtendedGamepad object. The GCExtendedGamepadSnapshot class is a subclass of the GCExtendedGamepad class, so you can use the parent class’s properties to read the individual element values. To get the flattened data representation of the snapshot data, read the snapshotData property.

  • Initializes a snapshot object with the flattened data representation obtained from another snapshot.

    Declaration

    Swift

    init(snapshotData data: NSData)

    Objective-C

    - (instancetype _Nonnull)initWithSnapshotData:(NSData * _Nonnull)data

    Parameters

    data

    A data object that contains snapshot data.

    Return Value

    A new snapshot object.

    Discussion

    The data format for a snapshot is private. Your snapshot object should only be created from flattened data previously obtained from an extended snapshot.

    Availability

    Available in iOS 7.0 and later.

  • Initializes a snapshot object associated with a specific controller using a flattened data representation obtained from another snapshot.

    Declaration

    Swift

    init(controller controller: GCController, snapshotData data: NSData)

    Objective-C

    - (instancetype _Nonnull)initWithController:(GCController * _Nonnull)controller snapshotData:(NSData * _Nonnull)data

    Parameters

    controller

    The controller to associate the snapshot with.

    data

    A data object that contains snapshot data.

    Return Value

    A new snapshot object.

    Discussion

    The data format for a snapshot is private. Your snapshot object should only be created from flattened data previously obtained from an extended snapshot.

    Availability

    Available in iOS 7.0 and later.

  • Flattens a snapshot into an archivable memory representation.

    Declaration

    Swift

    @NSCopying var snapshotData: NSData

    Objective-C

    @property(atomic, copy, nonnull) NSData *snapshotData

    Discussion

    You can assign another NSData object containing extended snapshot data to this property. The elements of the extended snapshot are updated to the values stored in the flattened data. This triggers any value handlers attached to those elements.

    Availability

    Available in iOS 7.0 and later.