---
title: "photosPicker(isPresented:selection:matching:preferredItemEncoding:photoLibrary:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/photospicker(ispresented:selection:matching:preferreditemencoding:photolibrary:)"
---

# photosPicker(isPresented:selection:matching:preferredItemEncoding:photoLibrary:)

Presents a Photos picker that selects a PhotosPickerItem from a given photo library.

## Declaration

```swift
nonisolated func photosPicker(isPresented: Binding<Bool>, selection: Binding<PhotosPickerItem?>, matching filter: PHPickerFilter? = nil, preferredItemEncoding: PhotosPickerItem.EncodingDisambiguationPolicy = .automatic, photoLibrary: PHPhotoLibrary) -> some View

```

## Parameters

- `isPresented`: The binding to whether the Photos picker should be shown.
- `selection`: The item being shown and selected in the Photos picker.
- `filter`: Types of items that can be shown. Default is nil. Setting it to nil means all supported types can be shown.
- `preferredItemEncoding`: The encoding disambiguation policy of the selected item. Default is .automatic. Setting it to .automatic means the best encoding determined by the system will be used.
- `photoLibrary`: The photo library to choose from.

## Discussion

Discussion The user explicitly grants access only to items they choose, so photo library access authorization is not needed.

## See Also

### Selecting photos

- [PhotosPicker](photosui/photospicker.md)
- [photosPicker(isPresented:selection:matching:preferredItemEncoding:)](swiftui/view/photospicker(ispresented:selection:matching:preferreditemencoding:).md)
- [photosPicker(isPresented:selection:maxSelectionCount:selectionBehavior:matching:preferredItemEncoding:)](swiftui/view/photospicker(ispresented:selection:maxselectioncount:selectionbehavior:matching:preferreditemencoding:).md)
- [photosPicker(isPresented:selection:maxSelectionCount:selectionBehavior:matching:preferredItemEncoding:photoLibrary:)](swiftui/view/photospicker(ispresented:selection:maxselectioncount:selectionbehavior:matching:preferreditemencoding:photolibrary:).md)
- [photosPickerAccessoryVisibility(_:edges:)](swiftui/view/photospickeraccessoryvisibility(_:edges:).md)
- [photosPickerDisabledCapabilities(_:)](swiftui/view/photospickerdisabledcapabilities(_:).md)
- [photosPickerSearchText(_:)](swiftui/view/photospickersearchtext(_:).md)
- [photosPickerStyle(_:)](swiftui/view/photospickerstyle(_:).md)
- [photosPickerMetadataOptions(_:)](swiftui/view/photospickermetadataoptions(_:).md)
- [photosSharedAlbumCreationSheet(isPresented:defaultTitle:defaultSharingPolicy:photoLibrary:onCompletion:)](swiftui/view/photossharedalbumcreationsheet(ispresented:defaulttitle:defaultsharingpolicy:photolibrary:oncompletion:).md)
- [photosSharedAlbumCustomizationSheet(isPresented:albumIdentifier:photoLibrary:onCompletion:)](swiftui/view/photossharedalbumcustomizationsheet(ispresented:albumidentifier:photolibrary:oncompletion:).md)
- [photosSharedAlbumPostingSheet(isPresented:items:defaultAlbumIdentifier:photoLibrary:completion:)](swiftui/view/photossharedalbumpostingsheet(ispresented:items:defaultalbumidentifier:photolibrary:completion:).md)
