Skip to main content
CometChatCallButtons shows a voice and a video button for a user or a group. A tap starts the call: a 1:1 call that rings the other user, or a group meeting by sending a meeting message to the group. The message header uses it for its call region.
CometChatCallButtons showing voice and video call buttons

Where It Fits

CometChatCallButtons is the call entry point for a conversation. Give it a user or a group and it starts the call; the Kit presents the call on its own call screens, or hands the call to you to show yourself.

Quick Start

With calling on, the buttons place the call and show it themselves.
The screen is .cometChatCallPresenter()’s when your app installs it at its root, otherwise the buttons’ own full-screen cover.
  • A user — the Kit places a 1:1 call and shows it ringing on CometChatOutgoingCall; when the callee answers, that screen becomes the call.
  • A group — the Kit sends a meeting custom message and joins that meeting on CometChatOngoingCall. Group calls do not ring.
See Call Features.

Actions and Events

Callback Methods

Showing the Call Yourself

onCallInitiated and onStartDirectCall replace the Kit’s screens. You get the placed Call, or the meeting message, and show it yourself.
The buttons render only when something can show the call: the Kit built with the Calls SDK and calling turned on (CometChatSession.initialize(…, enableCalling: true)), or a click handler, onCallInitiated or onStartDirectCall set.

Taking the Tap Yourself

A click handler replaces the call entirely — the Kit starts nothing.

Errors

A failure goes to onError. With no user or group the error is INVALID_RECEIVER. After a failure the buttons stay in the error state until the next call succeeds, and a second tap while a call is starting starts another.
onError has the signature (CometChatError) -> Void.

Global Events

A 1:1 call also emits an outgoing-call event.
The Kit emits outgoingCall on CometChatEvents.

Functionality


Advanced Methods

Store Access

CallButtonsStore is the part that starts calls.
Pass one to store to observe its state — idle, initiating or error — or to share it.

Delegate

CometChatCallButtons is a View struct and has no delegate. Use its callbacks.

Subclassing

CometChatCallButtons is a View struct. Customise it with its parameters and style.

Style

CometChatCallButtonsStyle holds one CallButtonStyle per button and the gap between them. Set only what you change:

Next Steps

Outgoing Call

The ringing screen a 1:1 call opens

Ongoing Call

The screen a group meeting opens

Call Features

Set up calling in your app

Message Header

The header that embeds the call buttons