---
title: preferredDataSource
framework: avfaudio
role: symbol
role_heading: Instance Property
path: avfaudio/avaudiosessionportdescription/preferreddatasource
---

# preferredDataSource

The preferred audio data source for the port.

## Declaration

```swift
var preferredDataSource: AVAudioSessionDataSourceDescription? { get }
```

## Discussion

Discussion The value of this property indicates the data source selected using the setPreferredDataSource(_:) method. To see the actual data source, use the selectedDataSource property. If nil, the port doesn’t support selecting between multiple data sources, or no preferred data source has been selected.

## See Also

### Managing a Port’s Data Sources

- [dataSources](avfaudio/avaudiosessionportdescription/datasources.md)
- [selectedDataSource](avfaudio/avaudiosessionportdescription/selecteddatasource.md)
- [setPreferredDataSource(_:)](avfaudio/avaudiosessionportdescription/setpreferreddatasource(_:).md)
