Interactive previews iPhone

On Primary Photos Picker Action

Sets the primary action handler for the Photos picker.

On Primary Photos Picker Action - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview

Platform Compatibility

iOS 27.3+ iPadOS 27.3+ macOS 27.3+ visionOS 27.3+

Tags

SwiftUI Code

Docs
@State private var selectedPhotos: [PhotosPickerItem] = []

var body: some View {
    PhotosPicker(
        "FooBar",
        selection: $selectedPhotos,
        selectionRange: 2 ... 5
    )
    .photosPickerOnPrimaryAction {
        print("selection confirmed")
    }
}

Found an issue or have a suggestion?

Created: November 17, 2026Updated: November 17, 2026

More PhotosPicker Components

View all
Photos Picker - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Photos Picker

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

Photos Picker Title - iPadOS - Landscape - Liquid Glass - Light Mode - Preview
modifier

Photos Picker Title

Overrides the title of the Photos picker. The title is not visible on small screens, like the iPhone.

Photos Picker Prompt - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
modifier

Photos Picker Prompt

Sets the prompt of the Photos picker.

On Secondary Photos Picker Action - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
modifier

On Secondary Photos Picker Action

Sets the secondary action handler for the Photos picker.

Container Photo Picker - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
modifier

Container Photo Picker

Limits the Photos picker to only show items in the specified container. In this case, to the user-created album "CustomAlbum".

Custom Photo Picker Buttons - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
modifier

Custom Photo Picker Buttons

Sets the primary and secondary button types of the Photos picker.

Disable Automatic Photos Picker Dismissal - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
modifier

Disable Automatic Photos Picker Dismissal

Prevents the Photos picker from dismissing automatically. Without this modifier, the Photos picker would automatically dismiss when an image is tapped.

Range Photo Picker - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
modifier

Range Photo Picker

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

Explore Other Components

Browse all
Move Disabled - iOS on iPhone - Portrait - Flat Design - Light Mode - Preview
modifier

Move Disabled

Adds a condition for whether the view’s view hierarchy is movable.

Uniform Concentric Rectangle - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Uniform Concentric Rectangle

Create a rectangle with the same corner style set on four corners.

TabBarOnlyTabViewStyle - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

TabBarOnlyTabViewStyle

A tab view style that displays a tab bar when possible.

Text Format - iOS on iPhone - Portrait - Flat Design - Light Mode - Preview
initializer

Text Format

Creates a text view that displays the formatted representation of a nonstring type supported by a corresponding format style.

Toolbar Vertical Edge - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
environment

Toolbar Vertical Edge

This value reflects the system’s preferred edge for the vertical bar in the current context, regardless of whether a vertical bar is currently visible. Use it to position custom bars or other UI relative to the system’s bar placement.

Default Tab Bar Placement - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
modifier

Default Tab Bar Placement

Specifies the preferred placement for the tabs of a TabView in the sidebarAdaptable style on platforms where the tab bar cannot adapt between different representations, and only one representation can be shown. For example, on iOS, it can enforce the sidebar on large-screen devices like the Pro Max, and iPhone Duo. This modifier has no effect on iPadOS.

Semantic Colors - iOS on iPhone - Portrait - Flat Design - Light Mode - Preview
type

Semantic Colors

Tab View Side Bar Bottom Bar - iPadOS - Landscape - Liquid Glass - Light Mode - Preview
modifier

Tab View Side Bar Bottom Bar

Adds a custom bottom bar to the sidebar of a tab view.