Add raise hand behavior in CometChat Calls SDK v5 on iOS so participants can request attention during group calls.
Allow participants to raise their hand to get attention during calls. This feature is useful for large meetings, webinars, or any scenario where participants need to signal they want to speak.
Participant carries no raised-hand property, and the SDK exposes no getter for one. Keep an
ordered list of your own, driven by the onParticipantHandRaised / onParticipantHandLowered
callbacks.
These callbacks fire only when a hand goes up or down. A client that joins mid-call cannot
discover hands that were already raised before it joined.
Swift
Objective-C
// Raised hands, oldest first. Keyed by uid, because that is the only identifier// `Participant` actually carries.private var raisedHands: [(uid: String, name: String, at: Date)] = []func onParticipantHandRaised(participant: Participant) { guard let uid = participant.uid else { return } DispatchQueue.main.async { guard !self.raisedHands.contains(where: { $0.uid == uid }) else { return } self.raisedHands.append((uid, participant.name ?? uid, Date())) self.updateRaisedHandsList(self.raisedHands) }}func onParticipantHandLowered(participant: Participant) { guard let uid = participant.uid else { return } DispatchQueue.main.async { self.raisedHands.removeAll { $0.uid == uid } self.updateRaisedHandsList(self.raisedHands) }}// Someone who leaves should not stay in the queue.func onParticipantLeft(participant: Participant) { guard let uid = participant.uid else { return } DispatchQueue.main.async { self.raisedHands.removeAll { $0.uid == uid } self.updateRaisedHandsList(self.raisedHands) }}