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

# init(_:selection:matching:preferredItemEncoding:photoLibrary:)

Creates a picker with a title and selection from the photo library you specify, and optionally configures the types of items to show, item encoding, and label behavior.

```
nonisolated init<S>(_ title: S, selection: Binding<PhotosPickerItem?>, matching filter: PHPickerFilter? = nil, preferredItemEncoding: PhotosPickerItem.EncodingDisambiguationPolicy = .automatic, photoLibrary: PHPhotoLibrary) where S : StringProtocol
```

## Parameters

`title`

A string that describes the purpose of showing the picker.

`selection`

The item the picker displays in a selected state.

`filter`

The types of items that the picker shows.

`preferredItemEncoding`

The encoding policy of the selection.

`photoLibrary`

The photo library to select from.

---

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)