---
title: UIPickerViewDataSource
framework: uikit
role: symbol
role_heading: Protocol
path: uikit/uipickerviewdatasource
---

# UIPickerViewDataSource

The interface for a picker view’s data source.

## Declaration

```swift
@MainActor protocol UIPickerViewDataSource : NSObjectProtocol
```

## Overview

Overview The data source of a UIPickerView object must adopt this protocol to mediate between the picker view object and your app’s data model for that picker view. The data source provides the picker view with the number of components, and the number of rows in each component, for displaying the picker view data. Both methods in this protocol are required.

## Topics

### Providing counts for the picker view

- [numberOfComponents(in:)](uikit/uipickerviewdatasource/numberofcomponents(in:).md)
- [pickerView(_:numberOfRowsInComponent:)](uikit/uipickerviewdatasource/pickerview(_:numberofrowsincomponent:).md)

## Relationships

### Inherits From

- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Providing the picker data

- [dataSource](uikit/uipickerview/datasource.md)
