---
title: PhotosPicker
framework: photosui
role: symbol
role_heading: Structure
path: photosui/photospicker
---

# PhotosPicker

A view that displays a Photos picker for choosing assets from the photo library.

## Declaration

```swift
@MainActor @preconcurrency struct PhotosPicker<Label> where Label : View
```

## Overview

Overview Use the Photos picker view to browse and select images and videos from the photo library. The view contains methods for single selection and multiple selection. For example, the following code displays a button that — when pressed — shows a picker in multiple selection mode. import SwiftUI import PhotosUI

struct PhotosSelector: View {     @State var selectedItems: [PhotosPickerItem] = []

var body: some View {         PhotosPicker(selection: $selectedItems,                      matching: .images) {             Text("Select Multiple Photos")         }     } } When displaying the picker, you can use PHPickerFilter options to customize what it displays. For example, the following code displays images and excludes screenshots. PhotosPicker(selection: $selectedItems,              matching: .any(of: [.images, .not(.screenshots)])) {     Text("Select Photos") } The selection results you get are placeholder objects. A PhotosPickerItem conforms to Transferable, and allows you to load a representation you request. To load a SwiftUI Image and track progress, use loadTransferable(type:completionHandler:). func loadTransferable(from imageSelection: PhotosPickerItem) -> Progress {     return imageSelection.loadTransferable(type: Image.self) { result in         DispatchQueue.main.async {             guard imageSelection == self.imageSelection else { return }             switch result {             case .success(let image?):                 // Handle the success case with the image.             case .success(nil):                 // Handle the success case with an empty value.             case .failure(let error):                 // Handle the failure case with the provided error.             }         }     } } A failure can occur when the system attempts to retrieve the data. For example, if the picker tries to download data from iCloud Photos without a network connection. important: Image only supports PNG file types through its Transferable conformance, so you need to create a custom Transferable model to support other image types. See Bringing Photos picker to your SwiftUI app to learn more.

## Topics

### Creating a picker

- [init(selection:matching:preferredItemEncoding:label:)](photosui/photospicker/init(selection:matching:preferreditemencoding:label:).md)
- [init(selection:maxSelectionCount:selectionBehavior:matching:preferredItemEncoding:label:)](photosui/photospicker/init(selection:maxselectioncount:selectionbehavior:matching:preferreditemencoding:label:).md)
- [init(selection:matching:preferredItemEncoding:photoLibrary:label:)](photosui/photospicker/init(selection:matching:preferreditemencoding:photolibrary:label:).md)
- [init(selection:maxSelectionCount:selectionBehavior:matching:preferredItemEncoding:photoLibrary:label:)](photosui/photospicker/init(selection:maxselectioncount:selectionbehavior:matching:preferreditemencoding:photolibrary:label:).md)

### Creating a picker with a title

- [init(_:selection:matching:preferredItemEncoding:)](photosui/photospicker/init(_:selection:matching:preferreditemencoding:)-7jbef.md)
- [init(_:selection:matching:preferredItemEncoding:)](photosui/photospicker/init(_:selection:matching:preferreditemencoding:)-48f7l.md)
- [init(_:selection:maxSelectionCount:selectionBehavior:matching:preferredItemEncoding:)](photosui/photospicker/init(_:selection:maxselectioncount:selectionbehavior:matching:preferreditemencoding:)-8ac23.md)
- [init(_:selection:maxSelectionCount:selectionBehavior:matching:preferredItemEncoding:)](photosui/photospicker/init(_:selection:maxselectioncount:selectionbehavior:matching:preferreditemencoding:)-6m11r.md)
- [init(_:selection:matching:preferredItemEncoding:photoLibrary:)](photosui/photospicker/init(_:selection:matching:preferreditemencoding:photolibrary:)-bu7c.md)
- [init(_:selection:matching:preferredItemEncoding:photoLibrary:)](photosui/photospicker/init(_:selection:matching:preferreditemencoding:photolibrary:)-6bm2n.md)
- [init(_:selection:maxSelectionCount:selectionBehavior:matching:preferredItemEncoding:photoLibrary:)](photosui/photospicker/init(_:selection:maxselectioncount:selectionbehavior:matching:preferreditemencoding:photolibrary:)-5tpfd.md)
- [init(_:selection:maxSelectionCount:selectionBehavior:matching:preferredItemEncoding:photoLibrary:)](photosui/photospicker/init(_:selection:maxselectioncount:selectionbehavior:matching:preferreditemencoding:photolibrary:)-6fwsc.md)

## Relationships

### Conforms To

- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)
- [View](swiftui/view.md)

## See Also

### Photos picker for SwiftUI

- [Bringing Photos picker to your SwiftUI app](photokit/bringing-photos-picker-to-your-swiftui-app.md)
- [Implementing an inline Photos picker](photokit/implementing-an-inline-photos-picker.md)
- [PhotosPickerItem](photosui/photospickeritem.md)
- [PhotosPickerSelectionBehavior](photosui/photospickerselectionbehavior.md)
- [PhotosPickerStyle](photosui/photospickerstyle.md)
