> ## Documentation Index
> Fetch the complete documentation index at: https://www.cometchat.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Search

> Search conversations and messages together: one field, filter chips for unread, groups, photos, videos, links, documents and audio, and two paginated result sections.

`CometChatSearch` searches **conversations and messages together**. A search field, a rail
of filter chips and two result sections — Chats above, Messages below — each paginating as
you scroll.

![CometChatSearch showing filter chips and conversation results for a query](https://mintcdn.com/cometchat-22654f5b/pWDsskjSUHgot30F/images/ui-kit/ios/v6/docs-overview-search.png?fit=max\&auto=format\&n=pWDsskjSUHgot30F\&q=85\&s=7a8d7e49fd6b8049fb45eb30278c6b7a)

***

## Where It Fits

`CometChatSearch` is the way into everything already said. It is a whole screen with its
own field, not a list you embed, and it hands you back an SDK model to navigate with.

> [tab] SwiftUI
>
> ```
> CometChatSearch   ← you are here
>     │ onConversationClick(conversation)   → your message screen
>     └ onMessageClick(message)             → your message screen, at that message
> ```

> [tab] UIKit
>
> ```
> CometChatSearch   ← you are here
>     │ onConversationClick(conversation:indexPath:)   → your message screen
>     └ onMessageClick(message:)                       → your message screen, at that message
> ```
>
> `CometChatSearch` inherits from `CometChatListBase`, which supplies the navigation bar and
> the custom state-view slots.

Both toolkits read from the same store, including the chip rules and the result mapping, so
the SwiftUI and UIKit screens can never disagree about *what* to show.

***

## Quick Start

> [tab] SwiftUI
>
> ```swift theme={null}
> import CometChatSwiftUI
>
> struct SearchScreen: View {
>     var body: some View {
>         CometChatSearch(
>             onConversationClick: { conversation in openChat(conversation) },
>             onMessageClick: { message in openChat(at: message) }
>         )
>     }
> }
> ```

> [tab] UIKit
>
> The screen is a view controller with a real `UISearchController` in the navigation bar and
> the filter chips beneath it. The two section headers stay pinned under the chips while
> their rows scroll.
>
> ```swift theme={null}
> import CometChatUIKit
> import CometChatSDK
>
> let search = CometChatSearch()
> search.searchDelegate = self
> navigationController?.pushViewController(search, animated: true)
> ```
>
> ```swift theme={null}
> extension SearchCoordinator: CometChatSearchDelegate {
>     func onConversationClick(conversation: Conversation, indexPath: IndexPath) {
>         openChat(with: conversation)
>     }
>
>     func onMessageClick(message: BaseMessage) {
>         openChat(at: message)
>     }
> }
> ```

That is a working search screen: it debounces your typing, searches both halves, shows
three results a section with a "Show More" link, and paginates as you scroll.

> [!NOTE]
>
> Nothing is fetched until there is something to search for. With no text and no chip
> selected the screen shows its **initial** state, which is a separate state from "no
> results" and has its own slot and its own flag.

***

## Scoping a Search

### One half only

> [tab] SwiftUI
>
> ```swift theme={null}
> CometChatSearch(searchScopes: [.messages])
> ```

> [tab] UIKit
>
> ```swift theme={null}
> let search = CometChatSearch()
> search.set(searchIn: [.messages])
> ```
>
> From Objective-C, use `setSearchInScopeNames:` with the raw values — `@[@"messages"]`.
> `SearchScope` is a Swift enum and cannot cross into the Objective-C runtime.

The scope gates which halves are **requested**. It is not section order — sections are
always Chats then Messages, and a section with no results is simply absent.

### Inside one conversation

> [tab] SwiftUI
>
> ```swift theme={null}
> CometChatSearch(uid: "alice")        // this 1:1 only
> CometChatSearch(guid: "design")      // this group only
> ```
>
> `uid` wins if you set both.

> [tab] UIKit
>
> ```swift theme={null}
> let search = CometChatSearch()
> search.set(user: User(uid: "alice", name: "Alice"))
> ```
>
> ```swift theme={null}
> let groupSearch = CometChatSearch()
> groupSearch.set(guid: "design")
> ```
>
> Setting one clears the other.

A scoped search is **messages only**, whatever the search scopes say: there is one
conversation, so searching conversations is meaningless. The placeholder changes to name
the scope.

### Filtering the request

> [tab] SwiftUI
>
> ```swift theme={null}
> CometChatSearch(
>     conversationsRequestBuilder: {
>         ConversationRequest.ConversationRequestBuilder(limit: 30)
>             .setConversationType(conversationType: .group)
>     },
>     messagesRequestBuilder: {
>         MessagesRequest.MessageRequestBuilder().set(limit: 30)
>     }
> )
> ```

> [tab] UIKit
>
> ```swift theme={null}
> let search = CometChatSearch()
> search.set(conversationsRequestBuilder: {
>     ConversationRequest.ConversationRequestBuilder(limit: 30)
>         .setConversationType(conversationType: .group)
> })
> search.set(messagesRequestBuilder: {
>     MessagesRequest.MessageRequestBuilder().set(limit: 30)
> })
> ```

> [!NOTE]
>
> Each closure is called **fresh for every fetch**, so return a new builder each time
> rather than capturing one instance. A request builder is consumed by building: one
> shared instance would hand every page the same pagination cursor.

***

## The Filter Chips

Seven chips, in this order: **Unread, Groups, Photos, Videos, Links, Documents, Audio**.

They belong to four families, and the families are the whole behaviour:

| Family | Chips |
| - | - |
| Conversation | Unread, Groups |
| Media | Photos, Videos |
| Document | Documents, Audio |
| Link | Links |

Select one chip and **the rail collapses to that chip's family** — the other families stop
being drawn. Within a family chips combine, so Photos and Videos can both be on. Selecting a
filter also lifts the three-row preview and suppresses "Show More", because a filtered
search is already the thing you asked for.

Deselecting the last chip restores all seven.

### Choosing which chips exist

> [tab] SwiftUI
>
> ```swift theme={null}
> CometChatSearch(
>     searchFilters: [.photos, .videos, .links],
>     initialSearchFilter: .photos
> )
> ```
>
> `initialSearchFilter` pre-selects one. It is ignored if it is not in `searchFilters`.

> [tab] UIKit
>
> ```swift theme={null}
> let search = CometChatSearch()
> search.set(searchFilters: [.photos, .videos, .links], initialFilter: .photos)
> search.hideFilterChips = false
> ```

### Hiding the rail

> [tab] SwiftUI
>
> ```swift theme={null}
> CometChatSearch(hideFilterChips: true)
> ```

> [tab] UIKit
>
> Set `hideFilterChips = true`. The rail is hidden, and the table's inset with it.

***

## Result Sections

Two sections, fixed order:

| Section | Rows |
| - | - |
| **Chats** | conversations whose name matches |
| **Messages** | message hits — text, photo, video, audio, document or link |

A message row's kind is decided once, centrally, from the message itself — so a hit with a
URL in it renders as a link row in both toolkits, and an action, a card, a custom or an
interactive message all render as text rows.

> [!WARNING]
>
> A link row draws its URL as **plain, untappable text**. The row already has a
> destination — the message — and a tappable link inside it would give one row two.

Each section pages independently: three rows while you have typed text and no chip, a full
page otherwise, with "Show More" on a section that has more.

> [tab] SwiftUI
>
> The matched keyword is highlighted in **titles and subtitles**, every occurrence,
> case-insensitively.

> [tab] UIKit
>
> Section headers are 30 pt, and hidden in chips-only mode: a chip selected with no text
> typed. One cell class, `CometChatSearchListItem`, renders all four row shapes and reads the
> style. The matched keyword is highlighted in **titles and subtitles**, every occurrence,
> case-insensitively.

***

## Actions and Events

### Callback Methods

> [tab] SwiftUI
>
> | Prop | Signature |
> | - | - |
> | `onConversationClick` | `(CometChatSDK.Conversation) -> Void` |
> | `onMessageClick` | `(CometChatSDK.BaseMessage) -> Void` |
> | `onLoadConversations` | `([ChatConversation]) -> Void` |
> | `onLoadMessages` | `([SearchMessageEntry]) -> Void` |
> | `onEmpty` | `() -> Void` |
> | `onError` | `(CometChatError) -> Void` |
> | `onBack` | `() -> Void` |
> | `imageSource` | `any ImageSource` — loads avatars and media thumbnails; defaults to the Kit's shared cached loader |
>
> The two click callbacks hand back **SDK models**, so you can navigate with them directly.
> The two load callbacks hand back the **value types** the rows render, and fire on every
> emission — including the empty one when the field is cleared.
>
> `onBack` also decides who draws the back button. Leave it `nil` and the screen relies on the
> navigation stack it is pushed onto, exactly as a system screen would. Set it and the Kit
> draws its own chevron in the bar, hides the system's, and calls your closure.

> [tab] UIKit
>
> | Prop | Signature |
> | - | - |
> | `onConversationClicked` | `(Conversation, IndexPath) -> Void` |
> | `onMessageClicked` | `(BaseMessage) -> Void` |
>
> **Fluent setters**
>
> ```swift theme={null}
> let search = CometChatSearch()
>     .set(onConversationClick: { conversation, indexPath in
>         print(conversation.conversationId ?? "", indexPath.row)
>     })
>     .set(onMessageClick: { message in print(message.id) })
>     .set(onError: { error in print(error.localizedDescription) })
>     .set(onEmpty: { print("nothing matched") })
> ```
>
> **Delegate**
>
> ```swift theme={null}
> @objc public protocol CometChatSearchDelegate: AnyObject {
>     @objc optional func onConversationClick(conversation: Conversation, indexPath: IndexPath)
>     @objc optional func onMessageClick(message: BaseMessage)
>     @objc optional func onBackPress()
>     @objc optional func onError(error: NSError)
>     @objc optional func onLoadConversations(conversations: [Conversation])
>     @objc optional func onLoadMessages(messages: [BaseMessage])
>     @objc optional func onEmpty()
> }
> ```
>
> Every method is optional. Errors arrive as `NSError`, not a Swift error. The two `onLoad…`
> methods fire on every emission, including the empty one when the field is cleared.

> [!WARNING]
>
> `onError` fires only when **both** halves failed. One half failing is not an error state:
> that section is simply absent and the other section's rows show.

### Global Events

The screen raises nothing on the event buses. Navigation is yours, through the callbacks
or, in UIKit, the delegate.

### SDK Events (Real-Time, Automatic)

Search registers no SDK listeners. A result row is a snapshot of the moment it was fetched:
a message edited or deleted afterwards keeps its old text until the next search. That is
deliberate.

> [tab] SwiftUI
>
> There is nothing to connect or disconnect.

> [tab] UIKit
>
> There is no `connect()`/`disconnect()` pair.

***

## Functionality

> [tab] SwiftUI
>
> | Prop | Type | Default | Does |
> | - | - | - | - |
> | `searchStore` | `SearchStore?` | `nil` | supply one to share state across screens; omitted, the component makes its own |
> | `searchScopes` | `[SearchScope]` | `SearchScope.all` | which halves are requested |
> | `uid` / `guid` | `String?` | `nil` | scope the search to one conversation; messages only; `uid` wins if both are set |
> | `searchFilters` | `[SearchFilter]` | `SearchFilter.defaultOrder` | which chips exist |
> | `initialSearchFilter` | `SearchFilter?` | `nil` | which chip starts selected |
> | `conversationsRequestBuilder` | `(() -> ConversationRequest.ConversationRequestBuilder)?` | `nil` | the Chats request |
> | `messagesRequestBuilder` | `(() -> MessagesRequest.MessageRequestBuilder)?` | `nil` | the Messages request |
> | `searchText` | `Binding<String>?` | internal state | your own storage for the query |
> | `hintText` | `String?` | `nil` | overrides the placeholder, which otherwise names the scope |
> | `dateTimeFormatter` | `(any CometChatDateTimeFormatter)?` | `nil` | formats a **conversation** row's date and the day header over the messages; a message row's date is a fixed pattern and is not affected |
> | `style` | `CometChatSearchStyle` | — | see [Style](#style) |
> | `hideSearchBar` | `Bool` | `false` | hides the field, for a screen that drives the query itself through `searchText` |
> | `hideFilterChips` | `Bool` | `false` | hides the rail, and the inset with it |
> | `hideUserStatus` | `Bool` | `false` | the presence dot on a Chats row |
> | `hideGroupType` | `Bool` | `false` | the private / password group badge on a Chats row |
> | `hideDateSeparator` | `Bool` | `false` | the floating day header over the Messages section |
> | `hideLoadingState`, `hideEmptyState`, `hideErrorState`, `hideInitialState` | `Bool` | `false` | suppress a state's chrome entirely; each takes effect on the next state change |

> [tab] UIKit
>
> | Property | Type | Does |
> | - | - | - |
> | `searchStore` | `SearchStore` | the shared store; inject one to seed the screen or to share state |
> | `searchScopes`, `searchFilters`, `initialSearchFilter` | `[SearchScope]`, `[SearchFilter]`, `SearchFilter?` | readable and settable; `set(searchIn:)` and `set(searchFilters:initialFilter:)` are the fluent forms |
> | `user` / `group` | `CometChatSDK.User?` / `CometChatSDK.Group?` | the object form of the scope; setting one clears the other |
> | `dateTimeFormatter` | `(any CometChatDateTimeFormatter)?`, with a `static` default | formats a **conversation** row's date and the day header; a message row's date is a fixed pattern and is not affected |
> | `style` | `SearchStyle` | see [Style](#style) |
> | `listItemCellClass` | `AnyClass`, default `CometChatSearchListItem.self` | the cell class |
> | `hideSearchBar` | `Bool`, default `false` | detaches the `UISearchController` from the navigation item |
> | `hideFilterChips` | `Bool`, default `false` | hides the rail, and the table's inset with it |
> | `hideUserStatus`, `hideGroupType` | `Bool`, default `false` | the presence dot, and the private / password group badge, on a Chats row |
> | `hideLoadingState`, `hideEmptyState`, `hideErrorState`, `hideInitialState` | `Bool`, default `false` | each takes effect on the next state change; `setEmptyStateVisibility(_:)` and `setErrorStateVisibility(_:)` are the inverted fluent forms |

***

## Custom View Slots

### State views

Four states, four slots. The initial state and the no-results state are **separate**:

> [tab] SwiftUI
>
> ```swift theme={null}
> CometChatSearch(
>     loadingView: { AnyView(MySpinner()) },
>     emptyView: { AnyView(Text("Nothing matched")) },
>     errorView: { AnyView(MySearchErrorView()) },
>     initialView: { AnyView(MySearchPrompt()) }
> )
> ```
>
> > [!NOTE]
> >
> > `errorView` takes **no retry argument**. The built-in error view ships a real retry
> > button; a view you supply owns its own retry, because you own the view.

> [tab] UIKit
>
> ```swift theme={null}
> let search = CometChatSearch()
>     .set(loadingView: MyShimmerView())
>     .set(emptyView: MyEmptyView())
>     .set(errorView: MyErrorView())
>     .set(initialView: MyPromptView())
> ```
>
> The built-in chrome is an icon over a title over a subtitle. The error one also carries a
> real **retry** button, styled by the six `retryButton…` style properties.
>
> > [!NOTE]
> >
> > Install your own `errorView` and the built-in one goes away, retry button included — you
> > own the view, so you own its retry. The three `errorState…` properties below are for
> > restyling the **built-in** chrome instead.
>
> ```swift theme={null}
> let search = CometChatSearch()
> search.errorStateTitleText = "Oops!"
> search.errorStateSubTitleText = "Check your connection"
> search.errorStateImage = UIImage(systemName: "wifi.slash")
> ```
>
> The loading chrome is a 20-row shimmer, readable as `search.loadingView`.

### Row slots

Eleven slots. The whole conversation row:

> [tab] SwiftUI
>
> ```swift theme={null}
> CometChatSearch(
>     conversationItemView: { conversation in
>         AnyView(HStack {
>             Text(conversation.title).bold()
>             Spacer()
>             Text("\(conversation.unreadCount)")
>         })
>     }
> )
> ```
>
> …or just the pieces of it:
>
> ```swift theme={null}
> CometChatSearch(
>     conversationLeadingView: { AnyView(MyAvatar($0)) },
>     conversationTitleView: { AnyView(Text($0.title).italic()) },
>     conversationSubtitleView: { _ in AnyView(Text("tap to open")) },
>     conversationTrailingView: { AnyView(MyUnreadPill(count: $0.unreadCount)) }
> )
> ```
>
> > [!WARNING]
> >
> > `conversationItemView` **shadows all four** section slots. Supply the whole row and the
> > pieces are not consulted.
>
> Message rows have no pieces — one slot per kind, each replacing the whole row:
>
> ```swift theme={null}
> CometChatSearch(
>     textMessageItemView: { AnyView(Text($0.text ?? "")) },
>     imageMessageItemView: { AnyView(MyPhotoRow(message: $0)) },
>     videoMessageItemView: { AnyView(MyPhotoRow(message: $0)) },
>     audioMessageItemView: { AnyView(MyFileRow(message: $0)) },
>     documentMessageItemView: { AnyView(MyFileRow(message: $0)) },
>     linkMessageItemView: { AnyView(MyLinkRow(message: $0)) }
> )
> ```
>
> A link row asks `linkMessageItemView` **only** — it does not fall back to
> `textMessageItemView`, even though a link hit is a text message.

> [tab] UIKit
>
> Each slot returns a `UIView`:
>
> ```swift theme={null}
> let search = CometChatSearch()
> search.listItemViewForConversation = { conversation in
>     let label = UILabel()
>     label.text = conversation.conversationId
>     return label
> }
> ```
>
> …or just the pieces of a conversation row:
>
> ```swift theme={null}
> let search = CometChatSearch()
> search.leadingViewForConversation = { _ in MyAvatarView() }
> search.titleViewForConversation = { _ in UILabel() }
> search.subtitleViewForConversation = { _ in UILabel() }
> search.tailViewForConversation = { _ in MyUnreadPill() }
> ```
>
> > [!WARNING]
> >
> > `listItemViewForConversation` **shadows all four** section slots. Supply the whole row
> > and the pieces are not consulted.
>
> Message rows have no pieces — one slot per kind:
>
> | Slot | Takes |
> | - | - |
> | `listItemViewForMessage` | `BaseMessage` — text, and everything unmatched |
> | `listItemViewForImage` | `MediaMessage` |
> | `listItemViewForVideo` | `MediaMessage` |
> | `listItemViewForAudio` | `MediaMessage` |
> | `listItemViewForDocument` | `MediaMessage` |
> | `listItemViewForLink` | `TextMessage` |
>
> The aliases `set(conversationItemView:)`, `set(textMessageItemView:)`,
> `set(imageMessageItemView:)` and the rest work as setters too.
>
> All eleven are read when a row is configured, so a slot you set after the first results
> have arrived still takes effect.

### Replacing the cell

> [tab] SwiftUI
>
> Rows are replaced through the row slots above.

> [tab] UIKit
>
> ```swift theme={null}
> final class MySearchRow: CometChatSearchListItem {}
> ```
>
> Then hand the class to the screen — `search.listItemCellClass = MySearchRow.self`:
>
> ```swift theme={null}
> let search = CometChatSearch()
> search.listItemCellClass = CometChatSearchListItem.self
> ```

***

## Common Patterns

### Open the right screen from either section

> [tab] SwiftUI
>
> ```swift theme={null}
> CometChatSearch(
>     onConversationClick: { conversation in
>         openChat(conversation)
>     },
>     onMessageClick: { message in
>         // Jump straight to the hit, which is what a message result is for.
>         openChat(at: message)
>     }
> )
> ```

> [tab] UIKit
>
> ```swift theme={null}
> let search = CometChatSearch()
>     .set(onConversationClick: { [weak self] conversation, _ in
>         self?.pushChat(for: conversation)
>     })
>     .set(onMessageClick: { [weak self] message in
>         // Jump straight to the hit, which is what a message result is for.
>         self?.pushChat(at: message)
>     })
> ```

### A media picker

> [tab] SwiftUI
>
> Chips only, no text, one family:
>
> ```swift theme={null}
> CometChatSearch(
>     searchScopes: [.messages],
>     searchFilters: [.photos, .videos],
>     initialSearchFilter: .photos,
>     hideSearchBar: true
> )
> ```

> [tab] UIKit
>
> Combine `set(searchIn:)`, `set(searchFilters:initialFilter:)` and `hideSearchBar`, as in
> [Scoping a Search](#scoping-a-search).

### Search inside one chat

> [tab] SwiftUI
>
> ```swift theme={null}
> CometChatSearch(
>     guid: "design",
>     hideFilterChips: true,
>     onMessageClick: { message in openChat(at: message) }
> )
> ```

> [tab] UIKit
>
> Scope the screen with `set(user:)` or `set(guid:)` and set `hideFilterChips = true`, as in
> [Scoping a Search](#scoping-a-search).

### A messages-only picker

> [tab] SwiftUI
>
> Pass `searchScopes: [.messages]` and handle `onMessageClick`, as in
> [Scoping a Search](#scoping-a-search).

> [tab] UIKit
>
> `PickMessageVC`, the subclass under [Subclassing](#subclassing), is a messages-only picker.
> Present it and take the picked message back:
>
> ```swift theme={null}
> let picker = PickMessageVC()
> picker.onPick = { message in self.forward(message) }
> present(UINavigationController(rootViewController: picker), animated: true)
> ```

***

## Advanced Methods

### Driving the Field

> [tab] SwiftUI
>
> ```swift theme={null}
> @State private var query = ""
>
> CometChatSearch(searchText: $query)
> ```
>
> Your view owns the text, so a deep link can pre-fill it and a navigation can clear it. Leave
> it out and the component keeps its own.

> [tab] UIKit
>
> ```swift theme={null}
> let search = CometChatSearch()
> search.search("design")            // sets the field and searches
> let text = search.getSearchText()
> search.clearSearch()               // clears the field and the results
> search.reloadData()                // re-render after a style or slot change
> ```
>
> And the getters, which read through to the store:
>
> ```swift theme={null}
> let search = CometChatSearch()
> let filters: Set<SearchFilter> = search.getSelectedFilters()
> let conversations: [Conversation] = search.getConversations()
> let messages: [BaseMessage] = search.getMessages()
> ```

### Store Access

> [tab] SwiftUI
>
> Supply a `SearchStore` through `searchStore` to share state across screens or to seed a
> preview.

> [tab] UIKit
>
> `searchStore` is the shared `SearchStore`. Inject one to seed the screen or to share state.

### Subclassing

> [tab] SwiftUI
>
> `CometChatSearch` is a `View` struct. Customise it with its slots and style.

> [tab] UIKit
>
> Subclass and override:
>
> | Method | When |
> | - | - |
> | `defaultSetup()` | the table, the field and the rail have just been built |
> | `setupStyle()` | apply your own colours |
> | `showEmptyView()` / `showErrorView()` / `showLoadingView()` | a state is being rendered |
> | `removeLoadingView()` | take the shimmer down |
> | `renderCurrentState()` | the one place state becomes UI |
> | `reloadData()` | the refresh hook every setter goes through |
>
> ```swift theme={null}
> final class PickMessageVC: CometChatSearch {
>     var onPick: ((BaseMessage) -> Void)?
>
>     override func defaultSetup() {
>         super.defaultSetup()
>         set(searchIn: [.messages])
>         hideFilterChips = true
>         set(hintText: "Search messages to forward")
>         set(onMessageClick: { [weak self] message in
>             self?.onPick?(message)
>             self?.dismiss(animated: true)
>         })
>     }
>
>     override func setupStyle() {
>         super.setupStyle()
>         tableView.backgroundColor = .secondarySystemBackground
>     }
> }
> ```
>
> > [!WARNING]
> >
> > `CometChatListBase`'s `emptyLabel` is **not** what this screen draws — its chrome is an
> > icon and two labels, which one centred label cannot be. To change the copy, use a state
> > slot or the three `errorState…` properties.

### Objective-C

> [tab] SwiftUI
>
> Objective-C is covered on the UIKit tab.

> [tab] UIKit
>
> ```objc theme={null}
> CometChatSearch *search = [[CometChatSearch alloc] init];
> [search setSearchInScopeNames:@[@"messages"]];
> [search setWithHintText:@"Search messages"];
> search.hideFilterChips = YES;
> search.searchDelegate = self;
> [search setWithListItemViewForConversation:^UIView * _Nonnull(Conversation * _Nonnull c) {
>     UILabel *label = [[UILabel alloc] init];
>     label.text = c.conversationId;
>     return label;
> }];
> ```

***

## Style

> [tab] SwiftUI
>
> ```swift theme={null}
> var style = CometChatSearchStyle()
> style.filterChipSelectedBackgroundColor = .purple.opacity(0.15)
> style.highlightTextColor = .purple
>
> CometChatSearch(style: style)
> ```
>
> | Property | Affects |
> | - | - |
> | `backgroundColor` | the screen behind the results |
> | `filterChipBackgroundColor` / `…SelectedBackgroundColor` | a chip, unselected and selected |
> | `filterChipTextColor` / `…SelectedTextColor` | its label |
> | `filterChipIconTint` / `…SelectedIconTint` | its glyph |
> | `filterChipCornerRadius` | the pill's radius |
> | `highlightTextColor` | the matched keyword, wherever it appears |
> | `conversationTitleTextColor` / `conversationSubtitleTextColor` | a Chats row |
> | `messageTitleTextColor` / `messageSubtitleTextColor` | a Messages row |
> | `messageLinkTextColor` | a link row's URL |
> | `badgeBackgroundColor` / `badgeTextColor` | the unread badge |
> | `attachmentIconTint` / `attachmentIconBackgroundColor` | an audio or document row's glyph |

> [tab] UIKit
>
> Set the style on one screen, or on the class for every screen created afterwards.
>
> ```swift theme={null}
> let search = CometChatSearch()
> let style = SearchStyle()
> style.filterChipSelectedBackgroundColor = .systemPurple.withAlphaComponent(0.15)
> style.highlightTextColor = .systemPurple
>
> search.style = style              // this screen
> CometChatSearch.style = style     // every screen created afterwards
> ```
>
> | Property | Affects |
> | - | - |
> | `backgroundColor` | the screen behind the results |
> | `searchBarBackgroundColor` / `searchBarTextColor` / `searchBarPlaceholderTextColor` | the field |
> | `filterChipBackgroundColor` / `…SelectedBackgroundColor` | a chip, unselected and selected |
> | `filterChipTextColor` / `…SelectedTextColor` | its label |
> | `filterChipCornerRadius` | the pill's radius |
> | `highlightTextColor` | the matched keyword, wherever it appears |
> | `listItemTitleTextColor` / `listItemSubTitleTextColor` | a Chats row |
> | `messageTitleTextColor` / `messageSubtitleTextColor` | a Messages row |
> | `messageLinkTextColor` | a link row's URL |
> | `badgeBackgroundColor` / `badgeTextColor` | the unread badge |
> | `retryButtonTextColor` / `retryButtonBackgroundColor` / `retryButtonCornerRadius` | the built-in error view's retry |
> | `emptyTitleTextColor` / `errorTitleTextColor` and their `…SubTitle…` pairs | the state chrome |
>
> > [!NOTE]
> >
> > `searchIcon` and `tableViewSeparator` have no effect. Separators are off.

### Liquid Glass

The chip rail is chrome, so on iOS 26 and later it renders as Liquid Glass and the results
travel **behind** it. That is why the rail's height is a content inset rather than a gap:
with nothing moving behind the material there is nothing to refract, and the glass would
render as a plain fill.

It falls back to an opaque rail automatically on earlier systems and whenever **Reduce
Transparency** is on. You do not opt in or out per component.

***

## Next Steps

> [card] [Conversations](https://www.cometchat.com/docs/ui-kit/ios/v6/conversations.md)
>
> The list a search result opens

> [card] [Message List](https://www.cometchat.com/docs/ui-kit/ios/v6/message-list.md)
>
> Where a message result lands

> [card] [Users](https://www.cometchat.com/docs/ui-kit/ios/v6/users.md)
>
> The directory, for starting a new conversation


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.