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

# Screen Sharing

> CometChat Calling SDK v5 - Screen Sharing for iOS

View screen shares from other participants during a call. The iOS SDK can receive and display screen shares initiated from web clients.

<Note>
  The iOS Calls SDK does not support initiating screen sharing. Screen sharing can only be started from web clients. iOS participants can view shared screens.
</Note>

## How It Works

When a web participant starts screen sharing:

1. The SDK receives the screen share stream
2. The call layout automatically adjusts to display the shared screen prominently
3. iOS participants can view the shared content

## Listen for Screen Share Events

Monitor when participants start or stop screen sharing:

<Tabs>
  <Tab title="Swift">
    ```swift theme={null}
    class CallViewController: UIViewController, ParticipantEventListener {
        
        override func viewDidLoad() {
            super.viewDidLoad()
            CallSession.shared.addParticipantEventListener(self)
        }
        
        deinit {
            CallSession.shared.removeParticipantEventListener(self)
        }
        
        func onParticipantStartedScreenShare(participant: Participant) {
            print("\(participant.name ?? "") started screen sharing")
            // Layout automatically adjusts to show shared screen
        }

        func onParticipantStoppedScreenShare(participant: Participant) {
            print("\(participant.name ?? "") stopped screen sharing")
            // Layout returns to normal view
        }

        // Other callbacks...
        func onParticipantJoined(participant: Participant) {}
        func onParticipantLeft(participant: Participant) {}
        func onParticipantListChanged(participants: [Participant]) {}
        func onParticipantAudioMuted(participant: Participant) {}
        func onParticipantAudioUnmuted(participant: Participant) {}
        func onParticipantVideoPaused(participant: Participant) {}
        func onParticipantVideoResumed(participant: Participant) {}
        func onParticipantStartedRecording(participant: Participant) {}
        func onParticipantStoppedRecording(participant: Participant) {}
        func onParticipantHandRaised(participant: Participant) {}
        func onParticipantHandLowered(participant: Participant) {}
        func onDominantSpeakerChanged(participant: Participant) {}
    }
    ```
  </Tab>

  <Tab title="Objective-C">
    ```objectivec theme={null}
    @interface CallViewController () <ParticipantEventListener>
    @end

    @implementation CallViewController

    - (void)viewDidLoad {
        [super viewDidLoad];
        [[CallSession shared] addParticipantEventListener:self];
    }

    - (void)dealloc {
        [[CallSession shared] removeParticipantEventListener:self];
    }

    - (void)onParticipantStartedScreenShareWithParticipant:(Participant *)participant {
        NSLog(@"%@ started screen sharing", participant.name);
        // Layout automatically adjusts to show shared screen
    }

    - (void)onParticipantStoppedScreenShareWithParticipant:(Participant *)participant {
        NSLog(@"%@ stopped screen sharing", participant.name);
        // Layout returns to normal view
    }

    // Other callbacks...

    @end
    ```
  </Tab>
</Tabs>

## Check Screen Share Status

Use the `isPresenting` property on the `Participant` object to check if someone is sharing their screen:

<Tabs>
  <Tab title="Swift">
    ```swift theme={null}
    func onParticipantListChanged(participants: [Participant]) {
        if let presenter = participants.first(where: { $0.isPresenting }) {
            print("\(presenter.name ?? "") is currently sharing their screen")
        }
    }
    ```
  </Tab>

  <Tab title="Objective-C">
    ```objectivec theme={null}
    - (void)onParticipantListChangedWithParticipants:(NSArray<Participant *> *)participants {
        for (Participant *p in participants) {
            if (p.isPresenting) {
                NSLog(@"%@ is currently sharing their screen", p.name);
                break;
            }
        }
    }
    ```
  </Tab>
</Tabs>
