Instance Method

startRelativeAltitudeUpdates(to:withHandler:)

Starts the delivery of altitude data to the specified handler block.

Declaration

func startRelativeAltitudeUpdates(to queue: OperationQueue, withHandler handler: @escaping CMAltitudeHandler)

Parameters

queue

The operation queue on which to execute your handler block. The altimeter object stores a strong reference to this object. This parameter must not be nil.

handler

The handler block to execute when new altitude data is available. This parameter must not be nil. For information about the format of this block, see CMAltitudeHandler.

Discussion

Call this method to initiate the delivery of events. The altimeter object stores a strong reference to the specified queue and makes a copy of your block. If you call the method a second time, the altimeter object releases its references to the previous queue and handler before storing references to the new ones. So only the last installed handler receives events. When you no longer need the altitude data, or when an error occurs, call the stopRelativeAltitudeUpdates() method to stop the delivery of events.

If altitude data is not available on the current device, this method does nothing.

See Also

Starting and Stopping Altitude Updates

func stopRelativeAltitudeUpdates()

Stops the delivery of altitude data for this altimeter object

typealias CMAltitudeHandler

A block for receiving altitude data.