<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macOS: 13.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/photosPicker(isPresented:selection:matching:preferredItemEncoding:photoLibrary:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI",
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewP07_Photosb1_aB0E12photosPicker11isPresented9selection8matching21preferredItemEncoding12photoLibraryQrAA7BindingVySbG_ALyAD0dfL0VSgG0dB014PHPickerFilterVSgAO0M20DisambiguationPolicyVSo07PHPhotoO0CtF"
  },
  "title" : "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.

```
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

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

---

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)