ScreenShareStore
Introduction
ScreenShareStore provides a complete set of screen sharing APIs, including full-screen sharing on mobile, and screen / window source enumeration and targeted sharing on desktop (Win/Mac).Notice:
Use shared singleton to get the
ScreenShareStore instance. Do not attempt to initialize directly.Note:
Screen sharing state updates are delivered through the state publisher. Subscribe to it to receive real-time updates about screen sharing status.
Features
Screen Sharing: Start and stop screen sharing, with support for iOS App Group and desktop capture property configuration.
Source Enumeration: Enumerate shareable screens and application windows with thumbnails and icons for building source-picker UI (desktop only).
State Subscription: Real-time subscription to screen sharing state changes.
Subscribable Data
ScreenShareState fields are described below:
Property | Type | Description |
screenStatus | Screen sharing status. |
API List
Function | Description |
Singleton object. | |
Start screen sharing. | |
Stop screen sharing. | |
Reset to default state. |
Getting Instance
shared
Singleton object.
Screen Sharing
startScreenShare
Start screen sharing.
public func startScreenShare(appGroup: String) {fatalError("\(#function) must be overridden by subclass")}
Version
Supported since version 3.5.
Parameters
Parameter | Type | Description |
appGroup | String | The value must match the App Group string configured in the Broadcast Upload Extension, used for sharing data between the host app and the Extension, in the format group.<reverse-domain>. Passing an empty string is allowed but does not guarantee screen sharing stability; configuring it correctly is recommended. |
stopScreenShare
Stop screen capture.
public func stopScreenShare() {fatalError("\(#function) must be overridden by subclass")}
Version
Supported since version 3.5.
Reset
reset
Reset to default state.
public func reset() {fatalError("\(#function) must be overridden by subclass")}
Version
Supported since version 3.5.
Data Structures
ScreenShareState
Screen sharing state.
Property | Type | Description |
screenStatus | Screen sharing status. |
Usage Example
// Get singleton instancelet store = ScreenShareStore.shared// Subscribe to state changesstore.state.subscribe { state inprint("Screen sharing status: \(state.screenStatus)")}// Start screen sharingstore.startScreenShare(appGroup: "group.com.example.app")// Stop screen sharingstore.stopScreenShare()
