---
title: "init(selection:maxSelectionCount:selectionBehavior:matching:preferredItemEncoding:label:)"
framework: photosui
role: symbol
role_heading: Initializer
path: "photosui/photospicker/init(selection:maxselectioncount:selectionbehavior:matching:preferreditemencoding:label:)"
---

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

Creates a picker that selects a collection of items and optionally configures the max selection count, selection behavior, types of items to show, item encoding, and label behavior.

## Declaration

```swift
@preconcurrency nonisolated init(selection: Binding<[PhotosPickerItem]>, maxSelectionCount: Int? = nil, selectionBehavior: PhotosPickerSelectionBehavior = .default, matching filter: PHPickerFilter? = nil, preferredItemEncoding: PhotosPickerItem.EncodingDisambiguationPolicy = .automatic, @ViewBuilder label: @Sendable () -> Label)
```

## Parameters

- `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.
- `label`: The view that describes the action of choosing an item.

## See Also

### Creating a picker

- [init(selection:matching:preferredItemEncoding:label:)](photosui/photospicker/init(selection:matching:preferreditemencoding:label:).md)
- [init(selection:matching:preferredItemEncoding:photoLibrary:label:)](photosui/photospicker/init(selection:matching:preferreditemencoding:photolibrary:label:).md)
- [init(selection:maxSelectionCount:selectionBehavior:matching:preferredItemEncoding:photoLibrary:label:)](photosui/photospicker/init(selection:maxselectioncount:selectionbehavior:matching:preferreditemencoding:photolibrary:label:).md)
