---
title: "default(for:)"
framework: avfoundation
role: symbol
role_heading: Type Method
path: "avfoundation/avcapturedevice/default(for:)"
---

# default(for:)

Returns the default device that captures the specified media type.

## Declaration

```swift
class func `default`(for mediaType: AVMediaType) -> AVCaptureDevice?
```

## Parameters

- `mediaType`: A media type for the device.

## Return Value

Return Value The default device, or nil if no device with that media type exists.

## See Also

### Finding and monitoring devices

- [AVCaptureDevice.DiscoverySession](avfoundation/avcapturedevice/discoverysession.md)
- [default(_:for:position:)](avfoundation/avcapturedevice/default(_:for:position:).md)
- [init(uniqueID:)](avfoundation/avcapturedevice/init(uniqueid:).md)
- [wasConnectedNotification](avfoundation/avcapturedevice/wasconnectednotification.md)
- [wasDisconnectedNotification](avfoundation/avcapturedevice/wasdisconnectednotification.md)
- [devices(for:)](avfoundation/avcapturedevice/devices(for:).md)
- [devices()](avfoundation/avcapturedevice/devices().md)
