---
title: UIPhotoSearchSuggestion
framework: uikit
role: symbol
role_heading: Class
platforms: [iOS 27.0+, iPadOS 27.0+]
path: uikit/uiphotosearchsuggestion
---

# UIPhotoSearchSuggestion

An input suggestion that carries photo search metadata for people, subjects, locations, and time periods.

## Declaration

```swift
class UIPhotoSearchSuggestion
```

## Discussion

Discussion When someone types text that could match a photo library search, such as “photos from Paris last summer,” the system recognizes the input as a photo library search and delivers a UIPhotoSearchSuggestion through the textField(_:insertInputSuggestion:) or textView(_:insertInputSuggestion:) delegate method. Use as? UIPhotoSearchSuggestion to check whether the incoming UIInputSuggestion is a photo search suggestion and access its metadata. After receiving a suggestion, you have two options: Pass the object directly to the Photos framework to present a pre-populated photo picker, or read the whoValues, whatValues, whereValues, and whenValues arrays to build a custom search experience. You can’t create a UIPhotoSearchSuggestion directly. The system creates and delivers instances through the input suggestion system. Presenting a photo picker Pass the suggestion to PHPickerSearchText(photoSearchSuggestion:) to pre-populate a PHPickerViewController with photos matching the person’s search. class SearchViewController: UIViewController, UITextFieldDelegate, PHPickerViewControllerDelegate {     @IBOutlet var searchField: UITextField!

func textField(_ textField: UITextField,                    insertInputSuggestion inputSuggestion: UIInputSuggestion) {         if let photoSuggestion = inputSuggestion as? UIPhotoSearchSuggestion {             presentPhotosPicker(with: photoSuggestion)         }     }

func presentPhotosPicker(with suggestion: UIPhotoSearchSuggestion) {         var configuration = PHPickerConfiguration()         configuration.searchText = PHPickerSearchText(photoSearchSuggestion: suggestion)         let picker = PHPickerViewController(configuration: configuration)         picker.delegate = self         present(picker, animated: true)     }

func picker(_ picker: PHPickerViewController,                 didFinishPicking results: [PHPickerResult]) {         dismiss(animated: true)         // Handle selected photos.     } } Building a custom search If your app has its own photo search UI, read the filter arrays and construct your own query. func textField(_ textField: UITextField,                insertInputSuggestion inputSuggestion: UIInputSuggestion) {     guard let suggestion = inputSuggestion as? UIPhotoSearchSuggestion else { return }

// Build a custom query from the individual filter values.     let who = suggestion.whoValues        // e.g., ["John"]     let what = suggestion.whatValues      // e.g., ["hiking"]     let locations = suggestion.whereValues // e.g., ["Paris"]     let timeframes = suggestion.whenValues // e.g., ["last summer"]

performCustomPhotoSearch(people: who, subjects: what, locations: locations, timeframes: timeframes) }

## Topics

### Instance Properties

- [whatValues](uikit/uiphotosearchsuggestion/whatvalues.md)
- [whenValues](uikit/uiphotosearchsuggestion/whenvalues.md)
- [whereValues](uikit/uiphotosearchsuggestion/wherevalues.md)
- [whoValues](uikit/uiphotosearchsuggestion/whovalues.md)

## Relationships

### Inherits From

- [UIInputSuggestion](uikit/uiinputsuggestion.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Smart Reply for messaging

- [Adopting Smart Reply in your messaging or email app](uikit/adopting-smart-reply-in-your-messaging-or-email-app.md)
- [UIConversationContext](uikit/uiconversationcontext.md)
- [UIConversationContext.Entry](uikit/uiconversationcontext/entry.md)
- [UIMailConversationContext](uikit/uimailconversationcontext.md)
- [UIMailConversationContext.MailEntry](uikit/uimailconversationcontext/mailentry.md)
- [UIMessageConversationContext](uikit/uimessageconversationcontext.md)
- [UIMessageConversationContext.MessageEntry](uikit/uimessageconversationcontext/messageentry.md)
- [UIInputSuggestion](uikit/uiinputsuggestion.md)
- [UISmartReplySuggestion](uikit/uismartreplysuggestion.md)
