<!--
{
  "availability" : [
    "iOS: 27.3.0 -",
    "iPadOS: 27.3.0 -",
    "macOS: 27.3.0 -",
    "visionOS: 27.3.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/photosPicker(isPresented:selection:selectionRange:selectionBehavior:matching:preferredItemEncoding:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI",
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewP07_Photosb1_aB0E12photosPicker11isPresented9selection0I5Range0I8Behavior8matching21preferredItemEncodingQrAA7BindingVySbG_AMySayAD0dfN0VGGqd__AD0df9SelectionK0V0dB014PHPickerFilterVSgAP0O20DisambiguationPolicyVtSXRd__Si5BoundRtd__lF"
  },
  "title" : "photosPicker(isPresented:selection:selectionRange:selectionBehavior:matching:preferredItemEncoding:)"
}
-->

# photosPicker(isPresented:selection:selectionRange:selectionBehavior:matching:preferredItemEncoding:)

Presents a Photos picker that selects a collection of `PhotosPickerItem`, constrained to a range of selection counts.

```
nonisolated func photosPicker<R>(isPresented: Binding<Bool>, selection: Binding<[PhotosPickerItem]>, selectionRange: R, selectionBehavior: PhotosPickerSelectionBehavior = .default, matching filter: PHPickerFilter? = nil, preferredItemEncoding: PhotosPickerItem.EncodingDisambiguationPolicy = .automatic) -> some View where R : RangeExpression, R.Bound == Int
```

## Parameters

`isPresented`

The binding to whether the Photos picker should be shown.

`selection`

All items being shown and selected in the Photos picker.

`selectionRange`

The number of items that can be selected. For example, `1...10` requires between 1 and 10 items, `3...` requires at least 3 items without an upper limit, and `...5` allows up to 5 items with the default minimum. An upper bound below 1 is treated as 1, and a lower bound above the upper bound is lowered to it.

`selectionBehavior`

The selection behavior of the Photos picker. Default is `.default`.

`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 selected items. Default is `.automatic`. Setting it to `.automatic` means the best encoding determined by the system will be used.

## 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)