Measurements of the Earth's magnetic field relative to the device.


class CMMagnetometerData : CMLogItem


Your application can obtain samples of magnetometer measurements, as represented by instances of this class, from the block handler of the startMagnetometerUpdates(to:withHandler:) method or from the magnetometerData property of the CMMotionManager class.


Getting the Field Strength

var magneticField: CMMagneticField

Returns the magnetic field measured by the magnetometer.

struct CMMagneticField

A structure containing 3-axis magnetometer data


Inherits From

Conforms To

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