> ## 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.

# Call Logs

> The logged-in user's calls, newest first, with a call-back button on every row.

`CometChatCallLogs` lists the logged-in user's calls — incoming, outgoing and missed, voice
and video — newest first, paging as you scroll. Each row shows the other party, which way the
call went and when, with a call-back button that rings them again. Tapping a row hands you
the log, so you can open its details.

![CometChatCallLogs showing incoming, outgoing and missed calls with call-back buttons](https://mintcdn.com/cometchat-22654f5b/pWDsskjSUHgot30F/images/ui-kit/ios/v6/docs-overview-call-logs.png?fit=max\&auto=format\&n=pWDsskjSUHgot30F\&q=85\&s=8588b49cd6cf457e89811b4ad58e81c9)

***

## Where It Fits

```
Calls tab
    │
    ▼
┌───────────────────────────┐   onItemClick(log)    ┌──────────────────────────┐
│ CometChatCallLogs ← here  │ ────────────────────▶ │ CometChatCallLogDetails  │
└───────────────────────────┘                        └──────────────────────────┘
    │ call-back button
    ▼
CometChatOutgoingCall — rings the other party
```

The Kit has no in-app incoming-call screen: incoming calls ring through CallKit (see
[Call Features](https://www.cometchat.com/docs/ui-kit/ios/v6/call-features.md)).

The list needs calling turned on — `CometChatSession.initialize(appID:region:enableCalling: true)`
— and a logged-in user. See [Calling Integration](https://www.cometchat.com/docs/ui-kit/ios/v6/calling-integration.md).

***

## Quick Start

> [tab] SwiftUI
>
> As a tab, with nothing else:
>
> ```swift theme={null}
> struct CallsTab: View {
>     var body: some View {
>         CometChatCallLogs()
>     }
> }
> ```
>
> The list brings its own `NavigationStack` for its system navigation bar. To push the details
> screen from a row, put it in your stack instead and pass `embedsNavigationStack: false`:
>
> ```swift theme={null}
> struct CallsTab: View {
>     @State private var opened: ChatCallLog?
>
>     var body: some View {
>         NavigationStack {
>             CometChatCallLogs(embedsNavigationStack: false, onItemClick: { opened = $0 })
>                 .navigationDestination(isPresented: Binding(get: { opened != nil },
>                                                             set: { if !$0 { opened = nil } })) {
>                     if let opened { CometChatCallLogDetails(callLog: opened) }
>                 }
>         }
>     }
> }
> ```
>
> `onItemClick` has no default: with none, a tap does nothing.

> [tab] UIKit
>
> Push it — or make it a tab's root — and open a row's details:
>
> ```swift theme={null}
> let callLogs = CometChatCallLogs()
>     .set(goToCallLogDetail: { log, _, _ in
>         let details = CometChatCallLogDetails(callLog: log)
>         details.hidesBottomBarWhenPushed = true
>         navigationController?.pushViewController(details, animated: true)
>     })
> navigationController?.pushViewController(callLogs, animated: true)
> ```
>
> A row tap with no `onItemClick` looks up the other party — the `User`, or the `Group` for a
> group call — and hands it to `goToCallLogDetail`; a failed lookup goes to `onError`.
> `set(onItemClick:)` replaces both:
>
> ```swift theme={null}
> callLogs.set(onItemClick: { log in
>     navigationController?.pushViewController(CometChatCallLogDetails(callLog: log), animated: true)
> })
> ```

***

## Filtering Call Logs

The request builder takes a `CallLogsQuery` — a value, so the Kit never changes yours. It
applies from the first page. The default lists ringing calls (`category: .call`), 30 a page.

> [tab] SwiftUI
>
> ```swift theme={null}
> CometChatCallLogs(callLogRequestBuilder: CallLogsQuery(limit: 20, kind: .video))
> ```
>
> A new query passed later starts the list again from page one.

> [tab] UIKit
>
> ```swift theme={null}
> let missed = CometChatCallLogs()
>     .set(callRequestBuilder: CallLogsQuery(limit: 20, direction: .missed))
> ```
>
> Set later, the query starts the list again with it.

### Filter Recipes

| `CallLogsQuery` | Lists |
| - | - |
| `limit` | rows per page — default 30 |
| `kind` | `.voice` or `.video` calls only |
| `status` | one `ChatCallLogStatus` — `.missed`, `.ended`, `.rejected` … |
| `direction` | `.incoming`, `.outgoing` or `.missed` |
| `hasRecording` | only calls with a recording |
| `uid`, `guid` | only calls with one user, or in one group |
| `category` | `.call` (default) or `.meet` for group meetings |

***

## Rows

Each row is the other party's avatar and name, a direction icon with the call's date, and a
call-back button for the call's type. The other party is the group for a group call, the
receiver of a call you made, and the caller otherwise.

| Direction | When | Look |
| - | - | - |
| outgoing | you placed the call — whatever happened to it | `arrow.up.right`, `success` |
| missed | someone else's call that was `unanswered`, `missed` or `cancelled` | the missed art, `error`; the name in `error` |
| incoming | any other call, including one you rejected | `arrow.down.left`, `success` |

The date reads `14 October, 10:13 am` this year and `14 October 2025, 10:13 am` before it.

> [tab] SwiftUI
>
> Pass a `dateTimeFormatter` to write it yourself:
>
> ```swift theme={null}
> CometChatCallLogs(dateTimeFormatter: WeekdayOnly())
> ```

> [tab] UIKit
>
> `set(datePattern:)` writes it yourself; otherwise `dateTimeFormatter`'s buckets apply, when
> set:
>
> ```swift theme={null}
> callLogs.set(datePattern: { log in log.initiatedAt.formatted(date: .abbreviated, time: .shortened) })
> ```

***

## The Call-Back Button

On a 1:1 row the button rings the other party with the log's call type, on
[`CometChatOutgoingCall`](https://www.cometchat.com/docs/ui-kit/ios/v6/outgoing-call). On a group row the button is hidden,
because there is no one person to ring.

> [tab] SwiftUI
>
> The call is shown by `.cometChatCallPresenter()` when your app installs it, otherwise by the
> list itself.
>
> `onCallIconClick` replaces the default on every row, and shows the button on group rows too:
>
> ```swift theme={null}
> CometChatCallLogs(onCallIconClick: { log in callBack(log) })
> ```

> [tab] UIKit
>
> The call is presented by `CometChatCallPresenter` when your app has started it, otherwise from
> this screen.
>
> `set(onCallButtonClicked:)` replaces the default on every row, and shows the button on group
> rows too:
>
> ```swift theme={null}
> callLogs.set(onCallButtonClicked: { log in callBack(log) })
> ```

***

## Actions and Events

### Callback Methods

> [tab] SwiftUI
>
> | Callback | Fires when |
> | - | - |
> | `onItemClick` | a row is tapped |
> | `onItemLongClick` | a row is long-pressed — it replaces the options menu |
> | `onCallIconClick` | a call-back button is tapped |
> | `onBack` | the back button is tapped (hidden by default) |
> | `onLoad` | a page or a refresh lands with rows |
> | `onEmpty` | the list loaded and has no calls |
> | `onError` | a page fails, or a refresh fails while rows stay on screen |
> | `onOptionSelected` | a row option is chosen |
>
> ```swift theme={null}
> CometChatCallLogs(
>     onError: { error in report(error) },
>     onLoad: { logs in log("\(logs.count) calls") },
>     onEmpty: { log("no calls yet") }
> )
> ```

> [tab] UIKit
>
> | Callback | Fires when |
> | - | - |
> | `set(onItemClick:)` | a row is tapped |
> | `set(goToCallLogDetail:)` | a row is tapped and has been looked up — when `onItemClick` is not set |
> | `set(onItemLongClick:)` | a row is long-pressed — it replaces the options menu |
> | `set(onCallButtonClicked:)` | a call-back button is tapped |
> | `set(onBack:)` | the back button is tapped — by default it pops |
> | `set(onLoad:)` | a page or a refresh lands with rows |
> | `set(onEmpty:)` | the list loaded and has no calls |
> | `set(onError:)` | a page, a refresh that kept its rows, or a tap's lookup failed |
>
> ```swift theme={null}
> let callLogs = CometChatCallLogs()
>     .set(onLoad: { logs in log("\(logs.count) calls") })
>     .set(onEmpty: { log("no calls yet") })
>     .set(onError: { error in log(error) })
> ```

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

The list refreshes on pull-to-refresh, when a call ends — here or reported by the Chat
SDK — and when the connection comes back. It does not refetch when its screen reappears.

> [tab] SwiftUI
>
> Call `refresh()` on the list's store to refresh on demand. See [Store Access](#store-access).

> [tab] UIKit
>
> `refreshCallLogs()` refreshes on demand.

***

## Functionality

> [tab] SwiftUI
>
> | Parameter | Default | |
> | - | - | - |
> | `store` | a new store | a `CallLogsStore` to share or observe |
> | `callLogRequestBuilder` | ringing calls, 30 a page | a `CallLogsQuery` |
> | `embedsNavigationStack` | `true` | the list brings its own `NavigationStack` |
> | `imageSource` | the shared cached loader | where avatars are loaded from |
> | `dateTimeFormatter` | none | writes the date yourself |
> | `title` | "Calls" | the bar's title |
> | `hideToolbar` | `false` | the whole bar |
> | `hideTitle` | `false` | the title only |
> | `hideBackButton` | `true` | the list is usually a tab's root |
> | `hideSeparator` | `true` | a line between rows |
> | `hideLoadingState`, `hideEmptyState`, `hideErrorState` | `false` | each state view |
>
> ```swift theme={null}
> CometChatCallLogs(title: "Recents", hideBackButton: false, hideSeparator: false,
>                   onBack: { log("back") })
> ```
>
> Every option is also a modifier for all the call logs in a subtree. An initialiser argument
> wins:
>
> ```swift theme={null}
> MyAppRoot()
>     .cometChatCallLogsHidden([.separator, .title])
> ```

> [tab] UIKit
>
> | Property | Default | |
> | - | - | - |
> | `set(title:)` | "Calls" | a large title, on your navigation bar |
> | `hideTitle` | `false` | the title only |
> | `hideBackButton` | `true` | the list is usually a tab's root |
> | `hideNavigationBar` | `false` | the whole bar |
> | `hideSeparator` | `true` | a line between rows |
> | `setOverflowMenu(_:)` | none | a trailing bar item |
>
> ```swift theme={null}
> let callLogs = CometChatCallLogs()
>     .set(title: "Recents")
> callLogs.hideBackButton = false
> callLogs.hideSeparator = false
> ```
>
> `avatarStyle`, `dateStyle` and `dateTimeFormatter` are also properties of the view controller.

### States

| State | Shows |
| - | - |
| loading | thirty shimmer rows |
| content | the rows; a spinner under them while the next page loads |
| empty | `phone.fill`, "No Call Logs Yet" and "Make or receive calls to see your call history listed here" |
| error | "Oops!", "Looks like something went wrong. Please try again." and **Retry** |

A failed next page shows the error state; Retry starts again from page one. A failed refresh
keeps the rows on screen and reaches `onError`.

> [tab] SwiftUI
>
> Replace a state view with `loadingView`, `emptyView` or `errorView`, or hide it with
> `hideLoadingState`, `hideEmptyState` or `hideErrorState`.

> [tab] UIKit
>
> Subclasses can override `showLoadingView()`, `showEmptyView()`, `showErrorView()` and
> `hideStateViews()`.

***

## Custom View Slots

> [tab] SwiftUI
>
> Replace the whole row, or one part of it. Each slot receives the row's `ChatCallLog`:
>
> ```swift theme={null}
> CometChatCallLogs(
>     subtitleView: { log in AnyView(MyCallDirectionBadge(log)) },
>     trailingView: { log in AnyView(MyCallBackButton(log)) }
> )
> ```
>
> | Slot | Replaces |
> | - | - |
> | `listItemView` | the whole row — the others are then not used |
> | `leadingView` | the avatar |
> | `titleView` | the name |
> | `subtitleView` | the direction icon and the date |
> | `trailingView` | the call-back button |
> | `incomingCallIcon`, `outgoingCallIcon`, `missedCallIcon` | one direction icon |
> | `audioCallIcon`, `videoCallIcon` | the call-back button's glyph |
> | `loadingView`, `emptyView`, `errorView` | a state view; `errorView` receives the retry action |
> | `overflowMenu` | a trailing item in the bar |
>
> Or for every call log in a subtree:
>
> ```swift theme={null}
> MyAppRoot()
>     .cometChatCallLogListItemView { log in MyCallLogRow(log: log) }
>     .cometChatCallLogsEmptyView { MyNoCallsYet() }
> ```

> [tab] UIKit
>
> Each slot receives the row's `ChatCallLog` and returns a `UIView`:
>
> ```swift theme={null}
> let callLogs = CometChatCallLogs()
>     .set(subtitleView: { log in MyCallDirectionView(log: log) })
>     .set(trailView: { log in MyCallBackView(log: log) })
> ```
>
> | Slot | Replaces |
> | - | - |
> | `set(listItemView:)` | the whole row |
> | `set(leadingView:)` | the avatar |
> | `set(titleView:)` | the name |
> | `set(subtitleView:)` | the direction icon and the date |
> | `set(trailView:)` | the call-back button |
>
> Or replace the cell — `listItemCellClass` takes any `CometChatCallLogListItem` subclass:
>
> ```swift theme={null}
> callLogs.listItemCellClass = MyCallLogCell.self
> ```

***

## Menu Options

The call log has no row options of its own. Add yours, and both are shown: as trailing swipe
actions and as the long-press menu. A row with no options has neither.

> [tab] SwiftUI
>
> `options` and `addOptions` add yours.
>
> ```swift theme={null}
> CometChatCallLogs(
>     options: { _ in [MenuOption(id: "delete", title: "Delete", systemImage: "trash", isDestructive: true)] },
>     onOptionSelected: { log, option in
>         if option.id == "delete" { deleteCallLog(log) }
>     }
> )
> ```

> [tab] UIKit
>
> `set(options:)` and `add(options:)` add yours.
>
> ```swift theme={null}
> let callLogs = CometChatCallLogs()
>     .set(options: { log in
>         [CometChatCallOption(id: "delete", title: "Delete", icon: UIImage(systemName: "trash"),
>                              isDestructive: true, onClick: { log, _ in deleteCallLog(log) })]
>     })
> ```

***

## Advanced Methods

### Store Access

`CallLogsStore` pages the calls and keeps them current.

> [tab] SwiftUI
>
> Pass your own to read its `state`, to `refresh()` it, or to show fixed rows in a preview:
>
> ```swift theme={null}
> #Preview {
>     CometChatCallLogs(store: CallLogsStore(seeded: .populated(ChatCallLog.samples, hasMore: false)))
> }
> ```
>
> A seeded store never fetches. `store.sdkCallLog(for: log.id)` returns the Calls SDK's own
> `CallLog` behind a row, typed `Any`.

> [tab] UIKit
>
> The view controller's store is `callLogsStore`. `callLogsStore.sdkCallLog(for:)` returns the
> Calls SDK's own `CallLog` behind a row.

### Subclassing

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

> [tab] UIKit
>
> The view controller and its cell are `open`. Override `defaultSetup()`, `setupStyle()`,
> `reloadData()`, the state views, `configureOptions(for:indexPath:)`,
> `configureMenu(for:indexPath:)`, `onRefreshControlTriggered()` and the table methods:
>
> ```swift theme={null}
> final class TintedCallLogs: CometChatCallLogs {
>     override func setupStyle() {
>         super.setupStyle()
>         tableView.backgroundColor = .secondarySystemBackground
>     }
> }
> ```
>
> The cell's `configure(with:dateText:style:dateStyle:avatarStyle:theme:showsCallButton:showsSeparator:)`
> is its primary override point; its subviews (`titleLabel`, `dateLabel`, `directionImageView`,
> `callButton` …) are public.

***

## Accessibility

* Each row reads the other party's name, the direction and the call type; the call-back
  button is its own element, "Call back".
* The empty and error states are announced when they appear.

***

## Style

> [tab] SwiftUI
>
> `CometChatCallLogsStyle` is sparse: set only what you change. Row properties live in its
> `itemStyle`, a `CallLogListItemStyle`.
>
> ```swift theme={null}
> var style = CometChatCallLogsStyle()
> style.backgroundColor = .white
> style.itemStyle = CallLogListItemStyle(titleColor: .indigo, missedCallTitleColor: .orange,
>                                        avatarStyle: AvatarStyle(size: 40, backgroundColor: .orange))
>
> CometChatCallLogs(style: style)
> ```
>
> | Property | Default |
> | - | - |
> | `backgroundColor` | `background1` |
> | `navigationBarBackgroundColor`, `navigationBarItemsTintColor` | the background (below iOS 26), `iconTintPrimary` |
> | `emptyStateIcon`, `emptyStateTitle…`, `emptyStateSubtitle…` | `phone.fill` in `neutral300`; `heading4Bold` / `bodyRegular` |
> | `errorStateIcon`, `errorStateTitle…`, `errorStateSubtitle…` | the error art; `heading4Bold` / `bodyRegular` |
> | `retryButton…` | `white` on `primary`, radius 8 |
> | `loadingStateSurfaceColor` | `background3` |
> | `itemStyle.titleColor`, `titleFont` | `textPrimary`, `heading4Medium` |
> | `itemStyle.missedCallTitleColor` | `error` |
> | `itemStyle.subtitleColor`, `subtitleFont`, `dateStyle` | `textSecondary`, `bodyRegular` |
> | `itemStyle.incomingCallIcon…`, `outgoingCallIcon…`, `missedCallIcon…` | see [Rows](#rows) |
> | `itemStyle.audioCallIcon…`, `videoCallIcon…` | `phone` / `video` in `iconTintPrimary` |
> | `itemStyle.avatarStyle` | 48 pt |
> | `itemStyle.separatorColor`, `separatorHeight` | `strokeLight`, 1 |

> [tab] UIKit
>
> `CallLogStyle` holds the list's colours and fonts. Set the static default for every screen,
> or one screen's `style`:
>
> ```swift theme={null}
> CometChatCallLogs.style.missedCallTitleColor = .systemOrange
>
> let callLogs = CometChatCallLogs()
> callLogs.style.listItemTitleTextColor = .systemIndigo
> callLogs.avatarStyle.backgroundColor = .systemTeal
> callLogs.dateStyle.textColor = .systemGray
> ```
>
> | Property | Default |
> | - | - |
> | `backgroundColor` | `background1` |
> | `titleColor`, `titleFont`, `largeTitleColor`, `largeTitleFont` | the bar's title |
> | `navigationBarTintColor`, `navigationBarItemsTintColor` | the bar, the back and overflow items |
> | `listItemTitleTextColor`, `listItemTitleFont` | `textPrimary`, `heading4Medium` |
> | `missedCallTitleColor` | `error` |
> | `listItemSubTitleTextColor`, `listItemSubTitleFont` | `textSecondary`, `bodyRegular` — the date; `dateStyle` wins |
> | `incomingCallIcon…`, `outgoingCallIcon…` | `arrow.down.left` / `arrow.up.right` in `success` |
> | `missedCallIcon…` | the missed art in `error` |
> | `audioCallIcon…`, `videoCallIcon…` | `phone` / `video` in `iconTintPrimary` |
> | `separatorColor`, `separatorHeight` | `strokeLight`, 1 — when `hideSeparator` is off |
> | `emptyTitle…`, `emptySubTitle…`, `errorTitle…`, `errorSubTitle…` | `heading4Bold` / `bodyRegular` |
> | `retryButton…` | `white` on `primary`, radius 8 |
> | `shimmerColor` | `background3` |

***

## Next Steps

> [card] [Call Log Details](https://www.cometchat.com/docs/ui-kit/ios/v6/call-log-details.md)
>
> Show one call's details and history

> [card] [Outgoing Call](https://www.cometchat.com/docs/ui-kit/ios/v6/outgoing-call.md)
>
> The screen the call-back button opens

> [card] [Call Features](https://www.cometchat.com/docs/ui-kit/ios/v6/call-features.md)
>
> How calls ring and are presented

> [card] [Calling Integration](https://www.cometchat.com/docs/ui-kit/ios/v6/calling-integration.md)
>
> Turn calling on in your app


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