<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: -",
    "macOS: 13.0.0 -",
    "visionOS: -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "PhotoKit",
  "identifier" : "/documentation/PhotosUI/PhotosPicker/init(_:selection:maxSelectionCount:selectionBehavior:matching:preferredItemEncoding:)-8ac23",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "PhotosUI",
      "SwiftUI",
      "_PhotosUI_SwiftUI"
    ],
    "preciseIdentifier" : "s:015_PhotosUI_SwiftB00A6PickerVAA0cB04TextVRszrlE_9selection17maxSelectionCount0F8Behavior8matching21preferredItemEncodingACyAFGAD18LocalizedStringKeyV_AD7BindingVySayAA0adM0VGGSiSgAA0adhJ0V0aB014PHPickerFilterVSgAR0N20DisambiguationPolicyVtcfc"
  },
  "title" : "init(_:selection:maxSelectionCount:selectionBehavior:matching:preferredItemEncoding:)"
}
-->

# init(_:selection:maxSelectionCount:selectionBehavior:matching:preferredItemEncoding:)

Creates a picker with a title key and selection, and optionally configures the max selection count, selection behavior, types of items to show, item encoding, and label behavior.

```
nonisolated init(_ titleKey: LocalizedStringKey, selection: Binding<[PhotosPickerItem]>, maxSelectionCount: Int? = nil, selectionBehavior: PhotosPickerSelectionBehavior = .default, matching filter: PHPickerFilter? = nil, preferredItemEncoding: PhotosPickerItem.EncodingDisambiguationPolicy = .automatic)
```

## Parameters

`titleKey`

A string key that describes the purpose of showing the picker.

`selection`

The items the picker displays in a selected state.

`maxSelectionCount`

The maximum number of items available to select.

`selectionBehavior`

The selection behavior of the picker.

`filter`

The types of items that the picker shows.

`preferredItemEncoding`

The encoding policy of the selection.

---

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)