iOS Developer Library — Pre-Release

Developer

CoreMotion Framework Reference CMAccelerometerData Class Reference

Options
Deployment Target:

On This Page
Language:

CMAccelerometerData

An instance of the CMAccelerometerData class represents an accelerometer event. It is a measurement of acceleration along the three spatial axes at a moment of time. More...

Inheritance


Import Statement


Swift

import CoreMotion

Objective-C

@import CoreMotion;

Availability


Available in iOS 4.0 and later.
  • The acceleration measured by the accelerometer. (read-only)

    Declaration

    Swift

    var acceleration: CMAcceleration { get }

    Objective-C

    @property(readonly, nonatomic) CMAcceleration acceleration

    Discussion

    The description of the CMAcceleration structure type describes the fields used for measuring acceleration.

    Import Statement

    Swift

    import CoreMotion

    Availability

    Available in iOS 4.0 and later.

Data Types

  • The type of a structure containing 3-axis acceleration values.

    Declaration

    Swift

    struct CMAcceleration { var x: Double var y: Double var z: Double init() init(x x: Double, y y: Double, z z: Double) }

    Objective-C

    typedef struct { double x; double y; double z; } CMAcceleration;

    Discussion

    A G is a unit of gravitation force equal to that exerted by the earth’s gravitational field (9.81 m s−2).

    Import Statement

    Swift

    import CoreMotion

    Availability

    Available in iOS 4.0 and later.