Instance Method

setFocusModeLocked(lensPosition:completionHandler:)

Locks the lens position at the specified value.

Declaration

func setFocusModeLocked(lensPosition: Float, completionHandler handler: ((CMTime) -> Void)? = nil)

Parameters

lensPosition

The lens position. A value of currentLensPosition can be used to indicate that the caller does not wish to specify a value for lensPosition.

handler

A block that is called when lensPosition has been set to the value specified and focusMode is AVCaptureDevice.FocusMode.locked. The block receives a timestamp matching that of the first buffer to which all settings have been applied.

The timestamp is synchronized to the device clock, and thus must be converted to the master clock before comparison with the timestamps of buffers delivered by AVCaptureVideoDataOutput instance.

The client may pass nil for the handler parameter if knowledge of the operation's completion is not required.

Discussion

This method is the only way to set the lensPosition property.

This method throws an invalidArgumentException exception if lensPosition is set to an unsupported level. A genericException exception is thrown if the method is called without first obtaining exclusive access to the receiver using lockForConfiguration().

See Also

Managing the Lens Position

var lensPosition: Float

Indicates the focus position of the lens.

var isLockingFocusWithCustomLensPositionSupported: Bool

A Boolean value indicating whether the device supports locking focus to a specific lens position.

class let currentLensPosition: Float

A special constant representing the current lens position.