<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIPickerViewDataSource",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UIPickerViewDataSource"
  },
  "title" : "UIPickerViewDataSource"
}
-->

# UIPickerViewDataSource

The interface for a picker view’s data source.

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

## Overview

The data source of a [`UIPickerView`](/documentation/UIKit/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:)`](/documentation/UIKit/UIPickerViewDataSource/numberOfComponents(in:))

Asks the data source for the number of components in the picker view.

[`pickerView(_:numberOfRowsInComponent:)`](/documentation/UIKit/UIPickerViewDataSource/pickerView(_:numberOfRowsInComponent:))

Asks the data source for the number of rows for a specified component.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)
