---
title: "Container Photo Picker | Explore SwiftUI"
description: "Limits the Photos picker to only show items in the specified container. In this case, to the user-created album \"CustomAlbum\""
canonical_url: "https://exploreswiftui.com/library/photospicker/container-photo-picker"
meta:
  author: "Explore SwiftUI"
  "og:description": "Limits the Photos picker to only show items in the specified container. In this case, to the user-created album \"CustomAlbum\""
  "og:image": "https://exploreswiftui.com/_og/d/c_Component%2Ctitle_Container%2BPhoto%2BPicker%2Cdescription_~TGltaXRzIHRoZSBQaG90b3MgcGlja2VyIHRvIG9ubHkgc2hvdyBpdGVtcyBpbiB0aGUgc3BlY2lmaWVkIGNvbnRhaW5lci4gSW4gdGhpcyBjYXNlLCB0byB0aGUgdXNlci1jcmVhdGVkIGFsYnVtICJDdXN0b21BbGJ1bSIu%2Ccategory_PhotosPicker%2Cimage_~L2FwaS9pbWFnZXMvMjY2L3ZhcmlhbnRzLzIyNDM~dj0xNzk0OTEwNjk4NDIzJnI9MiZ3PTEyODAmcT04NSZmPWpwZWc%2CimageMode_crop%2CimagePosition_top%2CimageFrame_~cG9zaXRpb246IGFic29sdXRlOyByaWdodDogMDsgd2lkdGg6IDY0MHB4OyBoZWlnaHQ6IDQ4MHB4OyBkaXNwbGF5OiBmbGV4OyBvdmVyZmxvdzogaGlkZGVuOyBiYWNrZ3JvdW5kOiAjRkZGRkZGOyBib3gtc2hhZG93OiAwIC0xMHB4IDUwcHggcmdiYSgzNyw5OSwyMzUsMC4xOCk7IGJvcmRlci1sZWZ0OiAxcHggc29saWQgcmdiYSgwLDAsMCwwLjA2KTsgYm90dG9tOiAwOyBib3JkZXItdG9wOiAxcHggc29saWQgcmdiYSgwLDAsMCwwLjA2KTsgYm9yZGVyLXRvcC1sZWZ0LXJhZGl1czogNzRweDs%2Cprops_eyJwbGF0Zm9ybXMiOlsiaU9TIiwiaVBhZE9TIiwibWFjT1MiLCJ2aXNpb25PUyJdfQ%2Cp_Ii9saWJyYXJ5L3Bob3Rvc3BpY2tlci9jb250YWluZXItcGhvdG8tcGlja2VyIg%2Cs_0X0WlwPatZwgsf_U.png"
  "og:image:height": "630"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "Container Photo Picker | Explore SwiftUI"
  "twitter:description": "Limits the Photos picker to only show items in the specified container. In this case, to the user-created album \"CustomAlbum\""
  "twitter:image": "https://exploreswiftui.com/_og/d/c_Component%2Ctitle_Container%2BPhoto%2BPicker%2Cdescription_~TGltaXRzIHRoZSBQaG90b3MgcGlja2VyIHRvIG9ubHkgc2hvdyBpdGVtcyBpbiB0aGUgc3BlY2lmaWVkIGNvbnRhaW5lci4gSW4gdGhpcyBjYXNlLCB0byB0aGUgdXNlci1jcmVhdGVkIGFsYnVtICJDdXN0b21BbGJ1bSIu%2Ccategory_PhotosPicker%2Cimage_~L2FwaS9pbWFnZXMvMjY2L3ZhcmlhbnRzLzIyNDM~dj0xNzk0OTEwNjk4NDIzJnI9MiZ3PTEyODAmcT04NSZmPWpwZWc%2CimageMode_crop%2CimagePosition_top%2CimageFrame_~cG9zaXRpb246IGFic29sdXRlOyByaWdodDogMDsgd2lkdGg6IDY0MHB4OyBoZWlnaHQ6IDQ4MHB4OyBkaXNwbGF5OiBmbGV4OyBvdmVyZmxvdzogaGlkZGVuOyBiYWNrZ3JvdW5kOiAjRkZGRkZGOyBib3gtc2hhZG93OiAwIC0xMHB4IDUwcHggcmdiYSgzNyw5OSwyMzUsMC4xOCk7IGJvcmRlci1sZWZ0OiAxcHggc29saWQgcmdiYSgwLDAsMCwwLjA2KTsgYm90dG9tOiAwOyBib3JkZXItdG9wOiAxcHggc29saWQgcmdiYSgwLDAsMCwwLjA2KTsgYm9yZGVyLXRvcC1sZWZ0LXJhZGl1czogNzRweDs%2Cprops_eyJwbGF0Zm9ybXMiOlsiaU9TIiwiaVBhZE9TIiwibWFjT1MiLCJ2aXNpb25PUyJdfQ%2Cp_Ii9saWJyYXJ5L3Bob3Rvc3BpY2tlci9jb250YWluZXItcGhvdG8tcGlja2VyIg%2Cs_0X0WlwPatZwgsf_U.png"
  "twitter:title": "Container Photo Picker | Explore SwiftUI"
---

> Index of every page on this site: [llms.txt](https://exploreswiftui.com/llms.txt)

**Interactive previews**[ iPhone](https://exploreswiftui.com/iphone?element=266)

# **Container Photo Picker**

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

![Container Photo Picker - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/266/variants/2243?v=1794910698423&r=2&w=800&q=80&f=webp)

### **Platform Compatibility**

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

### **Tags**

### **SwiftUI Code**

[ Docs](<https://developer.apple.com/documentation/SwiftUI/View/photosPickerContainerIdentifier(_:)>)

```
@State private var selectedPhoto: PhotosPickerItem?
@State private var albumIdentifier: String?

var body: some View {
    PhotosPicker("FooBar", selection: $selectedPhoto)
        .photosPickerContainerIdentifier(albumIdentifier)
        .disabled(albumIdentifier == nil)
        .task { await loadAlbumIdentifier() }
}

private func loadAlbumIdentifier() async {
    guard await PHPhotoLibrary.requestAuthorization(for: .readWrite) == .authorized else {
        print("Full photo library access is required to find Custom Album.")
        return
    }

    let options = PHFetchOptions()
    options.predicate = NSPredicate(format: "title ==[c] %@", "CustomAlbum")

    guard let album = PHAssetCollection.fetchAssetCollections(
        with: .album,
        subtype: .albumRegular,
        options: options
    ).firstObject else {
        print("Custom Album not found.")
        return
    }

    albumIdentifier = album.localIdentifier
}
```

### **Found an issue or have a suggestion?**

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

### **More PhotosPicker Components **

[**View all **](https://exploreswiftui.com/library/photospicker)

![Photos Picker - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/271/variants/2279?v=1794914000934&r=2&w=412&q=75&f=webp)

### **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](https://exploreswiftui.com/api/images/270/variants/2261?v=1794910543223&r=2&w=412&q=75&f=webp)

### **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](https://exploreswiftui.com/api/images/269/variants/2259?v=1794910719258&r=2&w=412&q=75&f=webp)

### **Photos Picker Prompt**

Sets the prompt of the Photos picker.

![On Secondary Photos Picker Action - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/268/variants/2255?v=1794910758520&r=2&w=412&q=75&f=webp)

### **On Secondary Photos Picker Action**

Sets the secondary action handler for the Photos picker.

![On Primary Photos Picker Action - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/267/variants/2251?v=1794910789851&r=2&w=412&q=75&f=webp)

### **On Primary Photos Picker Action**

Sets the primary action handler for the Photos picker.

![Custom Photo Picker Buttons - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/265/variants/2235?v=1794910823065&r=2&w=412&q=75&f=webp)

### **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](https://exploreswiftui.com/api/images/264/variants/2231?v=1794910665768&r=2&w=412&q=75&f=webp)

### **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](https://exploreswiftui.com/api/images/263/variants/2229?v=1794910645062&r=2&w=412&q=75&f=webp)

### **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 **](https://exploreswiftui.com/)

![MultiDatePicker - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/67/variants/203?v=1790073478842&r=2&w=412&q=75&f=webp)

### **MultiDatePicker**

A control for picking multiple dates.

![Page Screen Sheet Size - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/144/variants/478?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Page Screen Sheet Size**

On devices smaller than a page of paper, such as iPhone, Apple Watch, and 8" or 11" iPads, the sheet fills the entire height and, unlike the default sheet on iPad, the full width. On macOS, .page behaves like .fitted.

![Concentric Rectangle - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/153/variants/498?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Concentric Rectangle**

A concentric rectangle whose corner radii are defined from the same circle center as its parent element. The outermost parent is the device frame.

![Bottom Accessory - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/89/variants/39?v=1794865453169&r=2&w=412&q=75&f=webp)

### **Bottom Accessory**

A modifier to place content above the tabs

![Custom Session Async URL Image - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/195/variants/299?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Custom Session Async URL Image**

A modifier that adds a URL session for asynchronous images contained in the view to use when fetching image data.

![Label Styles - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/149/variants/472?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Label Styles**

Sets the style for labels within this view.

![Capsule Text Field - macOS - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/240/variants/186?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Capsule Text Field**

Gives your text field a capsule shape. This only has a visible effect on macOS, where the capsule shape is not the default.

![Placeholder Icon Store View - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/215/variants/653?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Placeholder Icon Store View**

Creates a view to load a collection of products from the App Store using product identifiers, and merchandise them using an image and a custom placeholder icon.

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://exploreswiftui.com/#website","@type":"WebSite","description":"A visual library for SwiftUI APIs, components, and modifiers","inLanguage":"en-US","name":"Explore SwiftUI","url":"https://exploreswiftui.com/","publisher":{"@id":"https://exploreswiftui.com/#identity"}},{"@id":"https://exploreswiftui.com/library/photospicker/container-photo-picker#webpage","@type":"WebPage","dateModified":"2026-11-17T10:18:18.540Z","datePublished":"2026-11-17T09:15:18.984Z","description":"Limits the Photos picker to only show items in the specified container. In this case, to the user-created album \"CustomAlbum\"","name":"Container Photo Picker","url":"https://exploreswiftui.com/library/photospicker/container-photo-picker","breadcrumb":{"@id":"https://exploreswiftui.com/library/photospicker/container-photo-picker#breadcrumb"},"isPartOf":{"@id":"https://exploreswiftui.com/#website"},"mainEntity":{"@id":"https://exploreswiftui.com/library/photospicker/container-photo-picker#article"},"potentialAction":[{"@type":"ReadAction","target":["https://exploreswiftui.com/library/photospicker/container-photo-picker"]}],"primaryImageOfPage":{"@id":"https://exploreswiftui.com/#logo"}},{"@id":"https://exploreswiftui.com/#identity","@type":"Organization","description":"A visual library for SwiftUI APIs, components, and modifiers","name":"Explore SwiftUI","url":"https://exploreswiftui.com","logo":{"@id":"https://exploreswiftui.com/#logo"},"sameAs":["https://x.com/Typ0genius","https://mastodon.social/@Typ0genius"]},{"@id":"https://exploreswiftui.com/library/photospicker/container-photo-picker#article","citation":"https://developer.apple.com/documentation/SwiftUI/View/photosPickerContainerIdentifier(_:)","dateModified":"2026-11-17T10:18:18.540Z","datePublished":"2026-11-17T09:15:18.984Z","description":"Limits the Photos picker to only show items in the specified container. In this case, to the user-created album \"CustomAlbum\"","headline":"Container Photo Picker","inLanguage":"en-US","name":"Container Photo Picker","thumbnailUrl":"https://exploreswiftui.com/api/images/266/variants/2243?v=1794910698423&r=2","url":"https://exploreswiftui.com/library/photospicker/container-photo-picker","@type":["Article","TechArticle"],"about":{"@type":"Thing","name":"SwiftUI"},"author":{"@id":"https://exploreswiftui.com/#identity"},"hasPart":{"@id":"https://exploreswiftui.com/library/photospicker/container-photo-picker#source-code"},"image":{"@id":"https://exploreswiftui.com/#/schema/image/1"},"isPartOf":{"@id":"https://exploreswiftui.com/library/photospicker/container-photo-picker#webpage"},"mainEntityOfPage":{"@id":"https://exploreswiftui.com/library/photospicker/container-photo-picker#webpage"},"publisher":{"@id":"https://exploreswiftui.com/#identity"}},{"@id":"https://exploreswiftui.com/library/photospicker/container-photo-picker#source-code","@type":"SoftwareSourceCode","codeSampleType":"full example","description":"Limits the Photos picker to only show items in the specified container. In this case, to the user-created album \"CustomAlbum\"","name":"Container Photo Picker SwiftUI Example","programmingLanguage":"Swift","runtimePlatform":"SwiftUI","text":"@State private var selectedPhoto: PhotosPickerItem?\n@State private var albumIdentifier: String?\n\nvar body: some View {\n    PhotosPicker(\"FooBar\", selection: $selectedPhoto)\n        .photosPickerContainerIdentifier(albumIdentifier)\n        .disabled(albumIdentifier == nil)\n        .task { await loadAlbumIdentifier() }\n}\n\nprivate func loadAlbumIdentifier() async {\n    guard await PHPhotoLibrary.requestAuthorization(for: .readWrite) == .authorized else {\n        print(\"Full photo library access is required to find Custom Album.\")\n        return\n    }\n\n    let options = PHFetchOptions()\n    options.predicate = NSPredicate(format: \"title ==[c] %@\", \"CustomAlbum\")\n\n    guard let album = PHAssetCollection.fetchAssetCollections(\n        with: .album,\n        subtype: .albumRegular,\n        options: options\n    ).firstObject else {\n        print(\"Custom Album not found.\")\n        return\n    }\n\n    albumIdentifier = album.localIdentifier\n}","about":[{"@type":"Thing","name":"SwiftUI"},{"@type":"Thing","name":"PhotosPicker"},{"@type":"Thing","name":"Container Photo Picker"}]},{"@id":"https://exploreswiftui.com/library/photospicker/container-photo-picker#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Home","item":"https://exploreswiftui.com","position":1},{"@type":"ListItem","name":"PhotosPicker","item":"https://exploreswiftui.com/library/photospicker","position":2},{"@type":"ListItem","name":"Container Photo Picker","item":"https://exploreswiftui.com/library/photospicker/container-photo-picker","position":3}]},{"@id":"https://exploreswiftui.com/#logo","@type":"ImageObject","caption":"Explore SwiftUI","contentUrl":"https://exploreswiftui.com/apple-touch-icon.png","inLanguage":"en","url":"https://exploreswiftui.com/apple-touch-icon.png"},{"@id":"https://exploreswiftui.com/#/schema/image/1","@type":"ImageObject","contentUrl":"https://exploreswiftui.com/api/images/266/variants/2243?v=1794910698423&r=2","inLanguage":"en","url":"https://exploreswiftui.com/api/images/266/variants/2243?v=1794910698423&r=2"}]}
```