---
title: autoFocusRangeRestriction
framework: avfoundation
role: symbol
role_heading: Instance Property
path: avfoundation/avcapturedevice/autofocusrangerestriction-swift.property
---

# autoFocusRangeRestriction

A value that controls the allowable range for automatic focusing.

## Declaration

```swift
var autoFocusRangeRestriction: AVCaptureDevice.AutoFocusRangeRestriction { get set }
```

## Discussion

Discussion By default, a device capable of hardware focusing attempts to focus on objects at any distance. If you expect to focus primarily on near or far objects, set a range restriction to increase the speed and reduce the power consumption of automatic focusing, and to reduce the chance of focusing ambiguities. Before changing the value of this property, you must call lockForConfiguration() to acquire exclusive access to the device’s configuration properties. Otherwise, setting the value of this property raises an exception. When you finish configuring the device, call unlockForConfiguration() to release the lock and allow other devices to configure the settings.

## See Also

### Configuring automatic focus

- [isFocusModeSupported(_:)](avfoundation/avcapturedevice/isfocusmodesupported(_:).md)
- [focusMode](avfoundation/avcapturedevice/focusmode-swift.property.md)
- [AVCaptureDevice.FocusMode](avfoundation/avcapturedevice/focusmode-swift.enum.md)
- [isSmoothAutoFocusSupported](avfoundation/avcapturedevice/issmoothautofocussupported.md)
- [isSmoothAutoFocusEnabled](avfoundation/avcapturedevice/issmoothautofocusenabled.md)
- [isFaceDrivenAutoFocusEnabled](avfoundation/avcapturedevice/isfacedrivenautofocusenabled.md)
- [automaticallyAdjustsFaceDrivenAutoFocusEnabled](avfoundation/avcapturedevice/automaticallyadjustsfacedrivenautofocusenabled.md)
- [isAutoFocusRangeRestrictionSupported](avfoundation/avcapturedevice/isautofocusrangerestrictionsupported.md)
- [AVCaptureDevice.AutoFocusRangeRestriction](avfoundation/avcapturedevice/autofocusrangerestriction-swift.enum.md)
