---
title: lockForConfiguration()
framework: avfoundation
role: symbol
role_heading: Instance Method
path: avfoundation/avcapturedevice/lockforconfiguration()
---

# lockForConfiguration()

Requests exclusive access to configure device hardware properties.

## Declaration

```swift
func lockForConfiguration() throws
```

## Discussion

Discussion To set hardware properties on a capture device, such as the focusMode and exposureMode, your app must first acquire a lock on the device. Only hold the device lock if your app requires settable device properties to remain unchanged. Holding the device lock unnecessarily may degrade capture quality in other apps sharing the device.

## See Also

### Configuring camera hardware

- [unlockForConfiguration()](avfoundation/avcapturedevice/unlockforconfiguration().md)
- [isSubjectAreaChangeMonitoringEnabled](avfoundation/avcapturedevice/issubjectareachangemonitoringenabled.md)
- [subjectAreaDidChangeNotification](avfoundation/avcapturedevice/subjectareadidchangenotification.md)
- [Formats](avfoundation/capture-device-formats.md)
- [Focus](avfoundation/capture-device-focus.md)
- [Exposure](avfoundation/capture-device-exposure.md)
- [White balance](avfoundation/capture-device-white-balance.md)
- [Lighting](avfoundation/capture-device-lighting.md)
- [Color](avfoundation/capture-device-color.md)
- [Zoom](avfoundation/capture-device-zoom.md)
