Contents

isContinuousAutoFocusTrackingEnabled

Indicates whether the device should use continuous autofocus tracking.

Declaration

var isContinuousAutoFocusTrackingEnabled: Bool { get set }

Discussion

The default value for this property is false. On a device with an active format where isContinuousAutoFocusTrackingSupported returns true and isContinuousAutoFocusTrackingEnabled is set to true, continuous autofocus tracking will be engaged when the device’s focus mode is set to AVCaptureFocusModeContinuousAutoFocus. When engaged, the subject at the current focusPointOfInterest will be tracked as it moves within the scene and will be kept in focus automatically. The device’s isContinuousAutoFocusTrackingSubjectAcquired property will return true while any tracked subject remains in the scene. However, the device’s focusPointOfInterest and focusRectOfInterest are not updated while continuous autofocus tracking is active. Continuous autofocus tracking can be made inactive by setting isContinuousAutoFocusTrackingEnabled to false and then setting the device’s focus mode to AVCaptureFocusModeContinuousAutoFocus or by setting the focus mode to a value other than AVCaptureFocusModeContinuousAutoFocus. When made inactive, isContinuousAutoFocusTrackingSubjectAcquired changes to false, as no subject is being tracked. For virtual cameras, continuous autofocus tracking only works on the activePrimaryConstituent.

To receive continuous autofocus tracking updates, it is required to connect this device to an AVCaptureMetadataOutput that is configured to deliver focusTrackedObject. If focusTrackedObject is not subscribed, no updates will be provided for continuous autofocus tracking and the device’s isContinuousAutoFocusTrackingSubjectAcquired property remains to be false.