### startCapture(completionHandler:) Source: https://developer.apple.com/documentation/screencapturekit/scstream/startcapture%28completionhandler%3A%29 Starts the stream with a callback to indicate whether it successfully starts. Available on Mac Catalyst 18.2+ and macOS 12.3+. ```APIDOC ## Instance Method # startCapture(completionHandler:) Starts the stream with a callback to indicate whether it successfully starts. Mac Catalyst 18.2+macOS 12.3+ ```swift func startCapture(completionHandler: (@Sendable ((any Error)?) -> Void)? = nil) ``` ## Parameters `completionHandler` A completion handler that provides an error if the stream fails to start. ``` -------------------------------- ### Start Screen Capture Asynchronously Source: https://developer.apple.com/documentation/screencapturekit/scstream/startcapture%28completionhandler%3A%29 This asynchronous version of `startCapture` can be used to start the stream. It throws an error if the stream fails to start. Available on macOS 12.3+ and Mac Catalyst 18.2+. ```swift func startCapture() async throws ``` -------------------------------- ### Start Screen Capture with Completion Handler Source: https://developer.apple.com/documentation/screencapturekit/scstream/startcapture%28completionhandler%3A%29 Use this method to start the screen capture stream and receive a callback indicating success or failure. Available on macOS 12.3+ and Mac Catalyst 18.2+. ```swift func startCapture(completionHandler: (@Sendable ((any Error)?) -> Void)? = nil) ``` -------------------------------- ### Start SCStream Capture Source: https://developer.apple.com/documentation/screencapturekit/scstream Starts the stream capture process. The completion handler is called to indicate whether the capture started successfully. ```swift func startCapture(completionHandler: (((any Error)?) -> Void)?) ``` -------------------------------- ### Handle Sharing Picker Start Failure Source: https://developer.apple.com/documentation/screencapturekit/sccontentsharingpickerobserver/contentsharingpickerstartdidfailwitherror%28_%3A%29 Implement this method to be notified when the content sharing picker fails to start. The `error` parameter provides details about the failure. ```swift func contentSharingPickerStartDidFailWithError(_ error: any Error) ``` -------------------------------- ### SCStreamDelegate - outputVideoEffectDidStart(for:) Source: https://developer.apple.com/documentation/screencapturekit/scstreamdelegate/outputvideoeffectdidstart%28for%3A%29 This method is called when the Presenter Overlay starts. It is available on Mac Catalyst 17.0+ and macOS 14.0+. ```APIDOC ## Instance Method # outputVideoEffectDidStart(for:) ### Description Tells the delegate that Presenter Overlay started. ### Availability Mac Catalyst 17.0+ macOS 14.0+ ### Signature ```swift optional func outputVideoEffectDidStart(for stream: SCStream) ``` ### Parameters #### stream - **stream** (SCStream) - Required - The stream using Presenter Overlay. ### See Also - `func outputVideoEffectDidStop(for: SCStream)` - Tells the delegate that Presenter Overlay stopped. ``` -------------------------------- ### startCapture() async throws Source: https://developer.apple.com/documentation/screencapturekit/scstream/startcapture%28completionhandler%3A%29 Starts the stream asynchronously. Available on Mac Catalyst 18.2+ and macOS 12.3+. ```APIDOC ## Instance Method # startCapture() Starts the stream asynchronously. Mac Catalyst 18.2+macOS 12.3+ ```swift func startCapture() async throws ``` ``` -------------------------------- ### SCStreamError.Code - failedToStartMicrophoneCapture Source: https://developer.apple.com/documentation/screencapturekit/scstreamerror/attempttoconfigstate Represents an error indicating that microphone capture failed to start. ```APIDOC ## SCStreamError.Code - failedToStartMicrophoneCapture ### Description An error message that indicates microphone capture failed to start. ### See Also - `SCStreamError.Code.failedToStartAudioCapture` ``` -------------------------------- ### Handle Picker Start Failure - SCContentSharingPickerObserver Source: https://developer.apple.com/documentation/screencapturekit/sccontentsharingpickerobserver Implement this method to be notified when the sharing picker fails to start. This is a required method for the SCContentSharingPickerObserver protocol and provides an error object detailing the failure. ```swift func contentSharingPickerStartDidFail(with: any Error) ``` -------------------------------- ### SCStreamError.Code.failedToStartAudioCapture Property Source: https://developer.apple.com/documentation/screencapturekit/scstreamerror/attempttostartstreamstate Indicates that an audio stream failed to start. ```swift static var failedToStartAudioCapture: SCStreamError.Code ``` -------------------------------- ### SCRecordingOutputDelegate - recordingOutputDidStartRecording(_:) Source: https://developer.apple.com/documentation/screencapturekit/screcordingoutputdelegate/recordingoutputdidstartrecording%28_%3A%29 This optional method is called when the recording output has started recording. It provides the SCRecordingOutput object associated with the recording. ```APIDOC ## recordingOutputDidStartRecording(_:) ### Description This optional delegate method is called when the recording output has started recording. It provides the `SCRecordingOutput` object associated with the recording. ### Method `optional func recordingOutputDidStartRecording(_ recordingOutput: SCRecordingOutput) ### Availability Mac Catalyst 18.2+ macOS 15.0+ ``` -------------------------------- ### SCStreamError.Code.failedToStart Property Source: https://developer.apple.com/documentation/screencapturekit/scstreamerror/attempttostartstreamstate Signifies a general failure when attempting to start a stream. ```swift static var failedToStart: SCStreamError.Code ``` -------------------------------- ### Get Current Process Shareable Content (Async/Await) Source: https://developer.apple.com/documentation/screencapturekit/scshareablecontent/getcurrentprocessshareablecontent%28completionhandler%3A%29 This property provides an asynchronous interface to get shareable content for the current process. It throws an error if retrieval fails. ```swift class var currentProcess: SCShareableContent { get async throws } ``` -------------------------------- ### contentSharingPickerStartDidFailWithError(_:) Source: https://developer.apple.com/documentation/screencapturekit/sccontentsharingpickerobserver/contentsharingpickerstartdidfailwitherror%28_%3A%29 Tells the observer that a sharing picker was unable to start. Available on Mac Catalyst 18.2+ and macOS 14.0+. ```APIDOC ## Instance Method ### contentSharingPickerStartDidFailWithError(_:) Tells the observer that a sharing picker was unable to start. **Availability** Mac Catalyst 18.2+ macOS 14.0+ ```swift func contentSharingPickerStartDidFailWithError(_ error: any Error) ``` ### Parameters - **error** (Error) - Required - The error that caused the picker failure. ``` -------------------------------- ### SCStreamError.Code.failedToStartMicrophoneCapture Property Source: https://developer.apple.com/documentation/screencapturekit/scstreamerror/attempttostartstreamstate Indicates a failure specifically when starting microphone capture. ```swift static var failedToStartMicrophoneCapture: SCStreamError.Code ``` -------------------------------- ### SCStreamError.Code - failedToStartAudioCapture Source: https://developer.apple.com/documentation/screencapturekit/scstreamerror/attempttoconfigstate Represents an error indicating that an audio stream failed to start. ```APIDOC ## SCStreamError.Code - failedToStartAudioCapture ### Description An error message that indicates an audio stream failed to start. ### See Also - `SCStreamError.Code.failedToStart` - `SCStreamError.Code.failedToStartMicrophoneCapture` ``` -------------------------------- ### SCStreamError.Code - failedToStart Source: https://developer.apple.com/documentation/screencapturekit/scstreamerror/attempttoconfigstate Represents an error indicating that a stream failed to start. ```APIDOC ## SCStreamError.Code - failedToStart ### Description An error message that indicates a stream failed to start. ### See Also - `SCStreamError.Code.attemptToStartStreamState` ``` -------------------------------- ### Initializer: init(display:excludingApplications:exceptingWindows:) Source: https://developer.apple.com/documentation/screencapturekit/sccontentfilter/init%28display%3Aexcludingapplications%3Aexceptingwindows%3A%29 Creates a filter that captures a display, excluding windows of the specified apps. This initializer provides a three-stage filter for fine-grained control over the capture output. ```APIDOC ## init(display:excludingApplications:exceptingWindows:) ### Description Creates a filter that captures a display, excluding windows of the specified apps. This initializer provides a three-stage filter for fine-grained control over the capture output. ### Method Initializer ### Endpoint N/A (Initializer) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example ```swift init( display: SCDisplay, excludingApplications applications: [SCRunningApplication], exceptingWindows: [SCWindow] ) ``` ### Response #### Success Response (200) N/A (Initializer) #### Response Example N/A (Initializer) ### Discussion The initializer arguments provide a three-stage filter that gives you fine-grained control over the output: 1. Specify a display to capture. If you don’t specify additional filter criteria, the stream includes all content for a display. 2. Specify one or more apps with windows to exclude from the output. 3. Specify one or more windows that are exceptions to the previous rules. If the previous rules include a window, specifying it as an exception excludes it from the output. Likewise, if the previous rules exclude a window, specifying it as an exception includes it in the output. ``` -------------------------------- ### Initializer: init(display:including:) Source: https://developer.apple.com/documentation/screencapturekit/sccontentfilter/init%28display%3Aincluding%3A%29 Creates a filter that captures only specific windows from a display. Available on Mac Catalyst 18.2+ and macOS 12.3+. ```APIDOC ## init(display:including:) ### Description Creates a filter that captures only specific windows from a display. ### Method Initializer ### Endpoint N/A (Initializer) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **display** (SCDisplay) - Required - A display to capture. - **includedWindows** ([SCWindow]) - Required - An array of windows to include in the output. ### Request Example ```swift init( display: SCDisplay, including includedWindows: [SCWindow] ) ``` ### Response #### Success Response (200) N/A (Initializer) #### Response Example N/A (Initializer) ``` -------------------------------- ### SCStreamError.Code.failedToStartMicrophoneCapture Source: https://developer.apple.com/documentation/screencapturekit/scstreamerror/failedtostartmicrophonecapture An error code indicating that microphone capture failed to start. This error is available on Mac Catalyst starting from version 18.0 and on macOS starting from version 15.0. ```APIDOC ## SCStreamError.Code.failedToMicrophoneCapture ### Description An error message that indicates microphone capture failed to start. ### Availability Mac Catalyst 18.0+ macOS 15.0+ ### Code Snippet ```swift static var failedToStartMicrophoneCapture: SCStreamError.Code { get } ``` ``` -------------------------------- ### Get and Set outputURL Source: https://developer.apple.com/documentation/screencapturekit/screcordingoutputconfiguration/outputurl Use this property to specify the URL for saving recorded content. Requires Mac Catalyst 18.2+ or macOS 15.0+. ```swift var outputURL: URL { get set } ``` -------------------------------- ### Initialize SCStream Source: https://developer.apple.com/documentation/screencapturekit/scstream/init%28filter%3Aconfiguration%3Adelegate%3A%29 Creates a stream with a content filter and configuration. Use this initializer to set up a screen capture stream, specifying what content to capture, how to configure the stream, and an optional delegate for event handling. ```swift init( filter contentFilter: SCContentFilter, configuration streamConfig: SCStreamConfiguration, delegate: (any SCStreamDelegate)? ) ``` -------------------------------- ### SCFrameStatus started Case Source: https://developer.apple.com/documentation/screencapturekit/scframestatus/idle Indicates the very first frame sent after the capture stream begins. Use this to identify the start of a capture session. ```swift case started ``` -------------------------------- ### Get Stream Type Source: https://developer.apple.com/documentation/screencapturekit/sccontentfilter/streamtype Use this property to get the type of streaming content. This property is deprecated; use the `style` property instead. ```swift var streamType: SCStreamType { get } ``` -------------------------------- ### Get and Set captureDynamicRange Source: https://developer.apple.com/documentation/screencapturekit/scstreamconfiguration/capturedynamicrange Use this property to get or set the dynamic range for screen captures. Available on Mac Catalyst 18.0+ and macOS 15.0+. ```swift var captureDynamicRange: SCCaptureDynamicRange { get set } ``` -------------------------------- ### Instance Method: present(for:using:) Source: https://developer.apple.com/documentation/screencapturekit/sccontentsharingpicker/present%28for%3Ausing%3A%29 Displays the picker with an existing capture stream, allowing for a single type of capture selection. Available on Mac Catalyst 18.2+ and macOS 14.0+. ```APIDOC ## Instance Method: present(for:using:) ### Description Displays the picker with an existing capture stream, allowing for a single type of capture selection. ### Method func present(for stream: SCStream, using contentStyle: SCShareableContentStyle) ### Parameters #### Path Parameters - **stream** (SCStream) - The stream to display in the picker. - **contentStyle** (SCShareableContentStyle) - The type of streaming content selection allowed through the presented picker. ### See Also - `func present()` - `func present(for: SCStream)` - `func present(using: SCShareableContentStyle)` ``` -------------------------------- ### Initialize SCRecordingOutput Source: https://developer.apple.com/documentation/screencapturekit/screcordingoutput Initializes an SCRecordingOutput instance with a configuration and a delegate. Requires SCRecordingOutputConfiguration and SCRecordingOutputDelegate. ```swift init(configuration: SCRecordingOutputConfiguration, delegate: any SCRecordingOutputDelegate) ``` -------------------------------- ### Get and Set videoCodecType Source: https://developer.apple.com/documentation/screencapturekit/screcordingoutputconfiguration/videocodectype Use this property to get or set the video codec type for recordings. Requires Mac Catalyst 18.2+ or macOS 15.0+. ```swift var videoCodecType: AVVideoCodecType { get set } ``` -------------------------------- ### Instance Method: present(using:) Source: https://developer.apple.com/documentation/screencapturekit/sccontentsharingpicker/present%28using%3A%29 Displays the picker for a single type of capture selection. Available on Mac Catalyst 18.2+ and macOS 14.0+. ```APIDOC ## Instance Method: present(using:) ### Description Displays the picker for a single type of capture selection. ### Method Instance Method ### Endpoint N/A (Instance Method) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example ```swift // Example usage: let picker = SCContentSharingPicker() picker.present(using: .window) ``` ### Response #### Success Response (200) N/A (This is a method call, not an API endpoint with a direct response) #### Response Example N/A ``` -------------------------------- ### SCContentFilter Initializer Parameters Source: https://developer.apple.com/documentation/screencapturekit/sccontentfilter/init%28display%3Aincluding%3Aexceptingwindows%3A%29 Details of the parameters for the init(display:including:exceptingWindows:) initializer. ```APIDOC ## Parameters for init(display:including:exceptingWindows:) `display` A display to capture. `applications` An array of apps with windows to capture. `exceptingWindows` An array of windows that are exceptions to the previous rules. ``` -------------------------------- ### Get and Set Capture Resolution Source: https://developer.apple.com/documentation/screencapturekit/scstreamconfiguration/captureresolution Use this property to get or set the resolution for capturing source content. Available on Mac Catalyst 17.0+ and macOS 14.0+. ```swift var captureResolution: SCCaptureResolutionType { get set } ``` -------------------------------- ### Get Current Process Shareable Content (Completion Handler) Source: https://developer.apple.com/documentation/screencapturekit/scshareablecontent/getcurrentprocessshareablecontent%28completionhandler%3A%29 Use this method to asynchronously retrieve shareable content for the current process. The completion handler receives the content or an error. ```swift class func getCurrentProcessShareableContent(completionHandler: @escaping @Sendable (SCShareableContent?, (any Error)?) -> Void) ``` -------------------------------- ### Initializer: init(desktopIndependentWindow:) Source: https://developer.apple.com/documentation/screencapturekit/sccontentfilter/init%28desktopindependentwindow%3A%29 Creates a filter that captures only the specified window. Available on Mac Catalyst 18.2+ and macOS 12.3+. ```APIDOC ## init(desktopIndependentWindow:) ### Description Creates a filter that captures only the specified window. ### Method Initializer ### Endpoint N/A (Initializer) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) None #### Response Example None ## Parameters `window` (SCWindow) - Required - A window to capture. ``` -------------------------------- ### ScreenCaptureKit Initializer Source: https://developer.apple.com/documentation/screencapturekit/screcordingoutput/init%28configuration%3Adelegate%3A%29 Initializes a new recording output with the specified configuration and delegate. Requires macOS 15.0+ or Mac Catalyst 18.2+. ```APIDOC ## init(configuration:delegate:) ### Description Initializes a new recording output with the specified configuration and delegate. ### Method `init` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) None #### Response Example None ### See Also - `class SCRecordingOutputConfiguration` - `protocol SCRecordingOutputDelegate` ``` -------------------------------- ### SCRunningApplication - processID Source: https://developer.apple.com/documentation/screencapturekit/scrunningapplication/processid The processID property returns the system process identifier (PID) of the running application. This property is available on Mac Catalyst starting from version 18.2 and on macOS starting from version 12.3. ```APIDOC ## Instance Property ### processID The system process identifier of the app. * **Availability:** Mac Catalyst 18.2+ , macOS 12.3+ ```swift var processID: pid_t { get } ``` ### See Also #### Inspecting an app * `var bundleIdentifier: String` * `var applicationName: String` ``` -------------------------------- ### Instance Property: applications Source: https://developer.apple.com/documentation/screencapturekit/scshareablecontent/applications Retrieves a list of running applications that are available for screen capture. Requires macOS 12.3+ or Mac Catalyst 18.2+. ```APIDOC ## Instance Property: applications ### Description The apps available for capture. ### Availability Mac Catalyst 18.2+ macOS 12.3+ ### Declaration ```swift var applications: [SCRunningApplication] { get } ``` ### See Also * Inspecting shareable content * `var windows: [SCWindow]` * `var displays: [SCDisplay]` ``` -------------------------------- ### ScreenCaptureKit Initializer: init(display:including:exceptingWindows:) Source: https://developer.apple.com/documentation/screencapturekit/sccontentfilter/init%28display%3Aincluding%3Aexceptingwindows%3A%29 Creates a filter to capture a specific display, including only windows from the specified applications, and excluding certain windows. Use this initializer for precise control over captured content. ```swift init( display: SCDisplay, including applications: [SCRunningApplication], exceptingWindows: [SCWindow] ) ``` -------------------------------- ### SCStream Initialization Source: https://developer.apple.com/documentation/screencapturekit/scstream Initializes a new SCStream instance with a content filter, configuration, and an optional delegate. ```APIDOC ## SCStream Initialization ### Description Creates a stream with a content filter and configuration. ### Method `init` ### Parameters - **filter** (`SCContentFilter`) - Required - The content filter to determine which screen content to capture. - **configuration** (`SCStreamConfiguration`) - Required - The configuration object for the stream output. - **delegate** (`any SCStreamDelegate`) - Optional - The delegate object to respond to stream events. ``` -------------------------------- ### Retrieve Shareable Content with Completion Handler Source: https://developer.apple.com/documentation/screencapturekit/scshareablecontent/getwithcompletionhandler%28_%3A%29 Use this method to get onscreen content that your app can capture. The system invokes the completion handler with shareable content or an error. ```swift class func getWithCompletionHandler(_ completionHandler: @escaping @Sendable (SCShareableContent?, (any Error)?) -> Void) ``` -------------------------------- ### Initializer: init(display:excludingWindows:) Source: https://developer.apple.com/documentation/screencapturekit/sccontentfilter/init%28display%3Aexcludingwindows%3A%29 Creates a filter that captures the contents of a display, excluding the specified windows. Available on Mac Catalyst 18.2+ and macOS 12.3+. ```APIDOC ## init(display:excludingWindows:) ### Description Creates a filter that captures the contents of a display, excluding the specified windows. ### Method Initializer ### Endpoint N/A (Initializer) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```swift init( display: SCDisplay, excludingWindows excluded: [SCWindow] ) ``` ### Response #### Success Response (200) N/A (Initializer) #### Response Example None ### Parameters - **display** (SCDisplay) - Required - A display to capture. - **excluded** (Array) - Required - An array of windows to exclude from the output. ``` -------------------------------- ### SCRecordingOutput Initialization Source: https://developer.apple.com/documentation/screencapturekit/screcordingoutput Initializes a new SCRecordingOutput object with the specified configuration and delegate. ```APIDOC ## SCRecordingOutput Initialization ### Description Initializes a new SCRecordingOutput object. ### Method `init(configuration: SCRecordingOutputConfiguration, delegate: any SCRecordingOutputDelegate)` ### Parameters - **configuration** (SCRecordingOutputConfiguration) - Required - The configuration for the recording output. - **delegate** (any SCRecordingOutputDelegate) - Required - The delegate object that handles recording output events. ``` -------------------------------- ### Initializers Source: https://developer.apple.com/documentation/screencapturekit/scstreamframeinfo Provides methods for initializing SCStreamFrameInfo instances. ```APIDOC ## Initializers `init(rawValue: String)` - Creates a new instance with a raw value. ``` -------------------------------- ### SCStreamError.Code.internalError Property Source: https://developer.apple.com/documentation/screencapturekit/scstreamerror/attempttostartstreamstate Indicates a stream cannot start due to an internal failure within ScreenCaptureKit. ```swift static var internalError: SCStreamError.Code ``` -------------------------------- ### Initialize SCStream Source: https://developer.apple.com/documentation/screencapturekit/scstream Creates a stream with a content filter and configuration. Ensure you have valid SCContentFilter and SCStreamConfiguration objects before initializing. ```swift init(filter: SCContentFilter, configuration: SCStreamConfiguration, delegate: (any SCStreamDelegate)?) ``` -------------------------------- ### SCStreamError.Code.failedToStartMicrophoneCapture Source: https://developer.apple.com/documentation/screencapturekit/scstreamerror/code/attempttoconfigstate Indicates a failure when starting microphone capture. Related to stream management errors. ```swift case failedToStartMicrophoneCapture ``` -------------------------------- ### ScreenCaptureKit - present(for: SCStream) Source: https://developer.apple.com/documentation/screencapturekit/sccontentsharingpicker/present%28%29 Displays the picker with an already running capture stream. ```APIDOC ## present(for: SCStream) ### Description Displays the picker with an already running capture stream. ### Method Instance Method ### Parameters #### Path Parameters - **stream** (SCStream) - Required - The active capture stream. ### Code Example ```swift func present(for stream: SCStream) ``` ``` -------------------------------- ### SCStreamError.Code.failedToStartAudioCapture Source: https://developer.apple.com/documentation/screencapturekit/scstreamerror/code/attempttoconfigstate Indicates a failure when starting an audio stream. Related to stream management errors. ```swift case failedToStartAudioCapture ``` -------------------------------- ### SCStreamError.Code.failedToStart Source: https://developer.apple.com/documentation/screencapturekit/scstreamerror/code/attempttoconfigstate Indicates a general failure when starting a stream. Related to stream management errors. ```swift case failedToStart ``` -------------------------------- ### SCScreenshotConfiguration Initializer Source: https://developer.apple.com/documentation/screencapturekit/scscreenshotconfiguration/dynamicrange-swift.enum/init%28rawvalue%3A%29 Initializes a dynamic range object from the specified raw value. ```APIDOC ## init(rawValue:) ### Description Creates a dynamic range object from the specified raw value. ### Method Initializer ### Endpoint N/A (Initializer) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) None #### Response Example None ### Notes Available on Mac Catalyst and macOS. ```swift init?(rawValue: Int) ``` ``` -------------------------------- ### Initialize SCRecordingOutput Source: https://developer.apple.com/documentation/screencapturekit/screcordingoutput/init%28configuration%3Adelegate%3A%29 Use this initializer to create an SCRecordingOutput object. It requires a recording output configuration and a delegate to handle recording events. Available on Mac Catalyst 18.2+ and macOS 15.0+. ```swift init( configuration recordingOutputConfiguration: SCRecordingOutputConfiguration, delegate: any SCRecordingOutputDelegate ) ``` -------------------------------- ### SCStreamError.Code - attemptToStartStreamState Source: https://developer.apple.com/documentation/screencapturekit/scstreamerror/attempttoconfigstate Represents an error when trying to start a stream that is already running or does not exist. ```APIDOC ## SCStreamError.Code - attemptToStartStreamState ### Description An error message that indicates a stream is already running or doesn’t exist when trying to start a stream. ### See Also - `SCStreamError.Code.attemptToConfigState` - `SCStreamError.Code.attemptToStopStreamState` ``` -------------------------------- ### Get Window Layer Source: https://developer.apple.com/documentation/screencapturekit/scwindow/windowlayer Retrieve the layer of the window relative to other windows. This property is read-only. ```swift var windowLayer: Int { get } ``` -------------------------------- ### Get Recorded Duration Source: https://developer.apple.com/documentation/screencapturekit/screcordingoutput/recordedduration Access the recorded duration of the current recording. This property is read-only. ```swift var recordedDuration: CMTime { get } ``` -------------------------------- ### SCContentFilter Initializer Discussion Source: https://developer.apple.com/documentation/screencapturekit/sccontentfilter/init%28display%3Aincluding%3Aexceptingwindows%3A%29 Explanation of how the initializer arguments provide a three-stage filter for controlling screen capture output. ```APIDOC ## Discussion for init(display:including:exceptingWindows:) The initializer arguments provide a three-stage filter that gives you fine-grained control over the output: 1. Specify a display to capture. If you don’t specify additional filter criteria, the stream includes all content for a display. 2. Specify one or more apps to capture only the windows that they own. 3. Specify one or more windows that are exceptions to the previous rules. If the previous rules include a window, specifying it as an exception excludes it from the output. Likewise, if the previous rules exclude a window, specifying it as an exception includes it in the output. ``` -------------------------------- ### Get SCContentFilter Style Source: https://developer.apple.com/documentation/screencapturekit/sccontentfilter/style Retrieve the display style of the sharable content. This property is read-only. ```swift var style: SCShareableContentStyle { get } ``` -------------------------------- ### SCRecordingOutputDelegate Protocol Methods Source: https://developer.apple.com/documentation/screencapturekit/screcordingoutputdelegate This section outlines the instance methods available for the SCRecordingOutputDelegate protocol, used for handling recording events. ```APIDOC ## SCRecordingOutputDelegate Protocol Mac Catalyst 18.2+macOS 15.0+ ```swift protocol SCRecordingOutputDelegate : NSObjectProtocol ``` ### Instance Methods `func recordingOutput(SCRecordingOutput, didFailWithError: any Error)` - **Description**: Called when the recording output encounters an error. - **Parameters**: - `SCRecordingOutput`: The recording output object. - `didFailWithError`: The error that occurred. `func recordingOutputDidFinishRecording(SCRecordingOutput)` - **Description**: Called when the recording output has finished recording. - **Parameters**: - `SCRecordingOutput`: The recording output object. `func recordingOutputDidStartRecording(SCRecordingOutput)` - **Description**: Called when the recording output has started recording. - **Parameters**: - `SCRecordingOutput`: The recording output object. ### Inherits From - `NSObjectProtocol` ### See Also #### Creating a recording output `init(configuration: SCRecordingOutputConfiguration, delegate: any SCRecordingOutputDelegate)` `class SCRecordingOutputConfiguration` ``` -------------------------------- ### SCStreamError.Code - internalError Source: https://developer.apple.com/documentation/screencapturekit/scstreamerror/attempttoconfigstate Represents an error indicating a stream cannot start due to an internal failure in ScreenCaptureKit. ```APIDOC ## SCStreamError.Code - internalError ### Description An error message that indicates a stream can’t start due to a failure in ScreenCaptureKit’s internals. ### See Also - `SCStreamError.Code.failedToStart` ``` -------------------------------- ### getExcludingDesktopWindows(_:onScreenWindowsOnlyBelow:) async throws Source: https://developer.apple.com/documentation/screencapturekit/scshareablecontent/getexcludingdesktopwindows%28_%3Aonscreenwindowsonlybelow%3Acompletionhandler%3A%29 Retrieves the displays, apps, and windows that are behind the specified window, with an option to exclude desktop windows. This is the async/await version. ```APIDOC ## GET /websites/developer_apple_screencapturekit/getExcludingDesktopWindows/async ### Description Retrieves the displays, apps, and windows that are behind the specified window, with an option to exclude desktop windows. This is the async/await version. ### Method GET ### Endpoint /websites/developer_apple_screencapturekit/getExcludingDesktopWindows/async ### Parameters #### Query Parameters - **excludeDesktopWindows** (Boolean) - Required - A Boolean value that indicates whether to exclude desktop windows from the set of shareable content. - **window** (SCWindow) - Required - The window above which to retrieve shareable content. ### Response #### Success Response (200) - **SCShareableContent** (SCShareableContent) - The shareable content matching the criteria. #### Error Response (4xx/5xx) - **Error** - An error object if the operation failed. #### Response Example ```json { "content": { ... } } ``` ``` -------------------------------- ### Starting and Stopping Stream Capture Source: https://developer.apple.com/documentation/screencapturekit/scstream Controls the initiation and termination of the screen content capture stream. ```APIDOC ## Starting and Stopping Stream Capture ### Description Starts or stops the capture of screen content. ### Methods #### Start Capture `func startCapture(completionHandler: (((any Error)?) -> Void)?) ### Parameters - **completionHandler** (((any Error)?) -> Void) - Optional - A callback that is executed after the capture attempt, indicating success or failure. #### Stop Capture `func stopCapture(completionHandler: (((any Error)?) -> Void)?) ### Parameters - **completionHandler** (((any Error)?) -> Void) - Optional - A callback that is executed after the capture is stopped. ``` -------------------------------- ### Initialize SCStreamConfiguration with a Preset Source: https://developer.apple.com/documentation/screencapturekit/scstreamconfiguration/init%28preset%3A%29 Use this initializer to create an SCStreamConfiguration object with a predefined preset. Available on Mac Catalyst 18.0+ and macOS 15.0+. ```swift convenience init(preset: SCStreamConfiguration.Preset) ``` -------------------------------- ### Creating a filter Source: https://developer.apple.com/documentation/screencapturekit/sccontentfilter Initializers for creating an SCContentFilter to capture specific windows, displays, or applications. ```APIDOC ## Initializers ### `init(desktopIndependentWindow: SCWindow)` Creates a filter that captures only the specified window. ### `init(display: SCDisplay, including: [SCWindow])` Creates a filter that captures only specific windows from a display. ### `init(display: SCDisplay, excludingWindows: [SCWindow])` Creates a filter that captures the contents of a display, excluding the specified windows. ### `init(display: SCDisplay, including: [SCRunningApplication], exceptingWindows: [SCWindow])` Creates a filter that captures a display, including only windows of the specified apps. ### `init(display: SCDisplay, excludingApplications: [SCRunningApplication], exceptingWindows: [SCWindow])` Creates a filter that captures a display, excluding windows of the specified apps. ``` -------------------------------- ### Get Default Configuration for SCContentSharingPicker Source: https://developer.apple.com/documentation/screencapturekit/sccontentsharingpicker/defaultconfiguration-94q2b Access the default configuration for the content capture picker. This property is read-write. ```swift var defaultConfiguration: SCContentSharingPickerConfiguration { get set } ``` -------------------------------- ### SCRecordingOutputConfiguration Class Source: https://developer.apple.com/documentation/screencapturekit/screcordingoutputconfiguration Provides configuration options for the output of a screen recording. ```APIDOC ## SCRecordingOutputConfiguration Mac Catalyst 18.2+ | macOS 15.0+ ```swift class SCRecordingOutputConfiguration ``` ### Description This class allows you to configure the output settings for a screen recording, including file types, video codecs, and the output destination. ### Instance Properties - `var availableOutputFileTypes: [AVFileType]` - An array of supported file types for the recording output. - `var availableVideoCodecTypes: [AVVideoCodecType]` - An array of supported video codec types for the recording. - `var outputFileType: AVFileType` - The specific file type to be used for the recording output. - `var outputURL: URL` - The URL where the recording output file will be saved. - `var videoCodecType: AVVideoCodecType` - The video codec type to be used for the recording. ### See Also - **Creating a recording output** - `init(configuration: SCRecordingOutputConfiguration, delegate: any SCRecordingOutputDelegate)` - `protocol SCRecordingOutputDelegate` ``` -------------------------------- ### SCStreamError.Code.internalError Source: https://developer.apple.com/documentation/screencapturekit/scstreamerror/code/attempttoconfigstate Indicates a stream cannot start due to an internal failure within ScreenCaptureKit. Related to stream management errors. ```swift case internalError ``` -------------------------------- ### SCStreamError.Code.failedToStartAudioCapture Source: https://developer.apple.com/documentation/screencapturekit/scstreamerror/code/failedtostartaudiocapture Represents an error where an audio stream failed to start. Available on Mac Catalyst 16.1+ and macOS 13.0+. ```APIDOC ## SCStreamError.Code.failedToStartAudioCapture ### Description An error message that indicates an audio stream failed to start. ### Availability Mac Catalyst 16.1+ macOS 13.0+ ### Code Example ```swift case failedToStartAudioCapture ``` ``` -------------------------------- ### SCStreamConfiguration Initializer Source: https://developer.apple.com/documentation/screencapturekit/scstreamconfiguration/init%28preset%3A%29 Initializes an SCStreamConfiguration object with a specified preset. ```APIDOC ## Initializer: init(preset:) ### Description Initializes a new instance of `SCStreamConfiguration` using a predefined preset. ### Method `convenience init(preset: SCStreamConfiguration.Preset)` ### Endpoint N/A (This is an initializer for a class) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```swift let configuration = SCStreamConfiguration(preset: .screen) ``` ### Response #### Success Response (200) N/A (Initializers do not return responses in the typical API sense) #### Response Example N/A ``` -------------------------------- ### SCStreamError.Code.failedToStart Source: https://developer.apple.com/documentation/screencapturekit/scstreamerror/code/failedtostart An error message that indicates a stream failed to start. Available on Mac Catalyst 15.4+ and macOS 12.3+. ```APIDOC ## SCStreamError.Code.failedToStart ### Description An error message that indicates a stream failed to start. ### Platform Availability Mac Catalyst 15.4+ macOS 12.3+ ### Code Example ```swift case failedToStart ``` ``` -------------------------------- ### Initialize SCStreamFrameInfo with Raw Value Source: https://developer.apple.com/documentation/screencapturekit/scstreamframeinfo/init%28rawvalue%3A%29 Creates a new instance of SCStreamFrameInfo using a provided raw string value. Important: Use static properties like `status` or `contentRect` instead of creating instances with this initializer. ```swift init(rawValue: String) ``` -------------------------------- ### SCScreenshotConfiguration.DisplayIntent Initializer Source: https://developer.apple.com/documentation/screencapturekit/scscreenshotconfiguration/displayintent-swift.enum/init%28rawvalue%3A%29 Creates a display intent object from the specified raw value. Available on Mac Catalyst and macOS. ```APIDOC ## init(rawValue:) ### Description Creates a display intent object from the specified raw value. ### Method Initializer ### Endpoint N/A (Initializer) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) None #### Response Example None ### Availability Mac Catalyst macOS ### Signature ```swift init?(rawValue: Int) ``` ``` -------------------------------- ### ScreenCaptureKit Initializer Source: https://developer.apple.com/documentation/screencapturekit/scstream/init%28filter%3Aconfiguration%3Adelegate%3A%29 Creates a stream with a content filter and configuration. Available on Mac Catalyst 18.2+ and macOS 12.3+. ```APIDOC ## init(filter:configuration:delegate:) ### Description Creates a stream with a content filter and configuration. ### Method Initializer ### Endpoint N/A (Initializer) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example ```swift init( filter contentFilter: SCContentFilter, configuration streamConfig: SCStreamConfiguration, delegate: (any SCStreamDelegate)? ) ``` ### Response #### Success Response (200) N/A (Initializer) #### Response Example N/A ``` -------------------------------- ### Get Application Name Source: https://developer.apple.com/documentation/screencapturekit/scrunningapplication/applicationname Retrieve the display name of the application. Requires macOS 12.3+ or Mac Catalyst 18.2+. ```swift var applicationName: String { get } ``` -------------------------------- ### Get Display Height - SCDisplay Source: https://developer.apple.com/documentation/screencapturekit/scdisplay Retrieve the height of the display in points. This property provides the vertical dimension of the display. ```swift var height: Int ``` -------------------------------- ### SCRunningApplication Class Source: https://developer.apple.com/documentation/screencapturekit/scrunningapplication Represents an application running on the device, providing properties to identify and inspect it. ```APIDOC ## Class SCRunningApplication An instance that represents an app running on a device. Mac Catalyst 18.2+ macOS 12.3+ ```swift class SCRunningApplication ``` ### Overview Retrieve the available apps from an instance of `SCShareableContent`. Select one or more apps to capture and use them to create an instance of `SCContentFilter`. Apply the filter to an instance of `SCStream` to limit its output to content matching your criteria. ### Topics #### Inspecting an app - `var processID: pid_t` The system process identifier of the app. - `var bundleIdentifier: String` The unique bundle identifier of the app. - `var applicationName: String` The display name of the app. ### Relationships #### Inherits From - `NSObject` #### Conforms To - `CVarArg` - `CustomDebugStringConvertible` - `CustomStringConvertible` - `Equatable` - `Hashable` - `NSObjectProtocol` ### See Also #### Shareable content - `class SCShareableContent` An instance that represents a set of displays, apps, and windows that your app can capture. - `class SCShareableContentInfo` An instance that provides information for the content in a given stream. - `enum SCShareableContentStyle` The style of content presented in a stream. - `class SCDisplay` An instance that represents a display device. - `class SCWindow` An instance that represents an onscreen window. ``` -------------------------------- ### Get Display Width - SCDisplay Source: https://developer.apple.com/documentation/screencapturekit/scdisplay Retrieve the width of the display in points. This property provides the horizontal dimension of the display. ```swift var width: Int ``` -------------------------------- ### System-based alert with Presenter Overlay Source: https://developer.apple.com/documentation/screencapturekit/scpresenteroverlayalertsetting/always Use this case to display an alert based on System Settings when using Presenter Overlay. ```swift case system ``` -------------------------------- ### Get SCDisplay Height Source: https://developer.apple.com/documentation/screencapturekit/scdisplay/height Access the height of the display in points. Available on Mac Catalyst 18.2+ and macOS 12.3+. ```swift var height: Int { get } ``` -------------------------------- ### Get and Set includeMenuBar Property Source: https://developer.apple.com/documentation/screencapturekit/sccontentfilter/includemenubar Use this property to control whether the menu bar is captured. It is a boolean value. ```swift var includeMenuBar: Bool { get set } ``` -------------------------------- ### Present Picker with Stream and Content Style Source: https://developer.apple.com/documentation/screencapturekit/sccontentsharingpicker/present%28for%3Ausing%3A%29 Use this method to display the picker with an existing capture stream, enabling a single type of capture selection. Requires macOS 14.0+ or Mac Catalyst 18.2+. ```swift func present( for stream: SCStream, using contentStyle: SCShareableContentStyle ) ``` -------------------------------- ### SCStreamError.Code.failedToStartAudioCapture Source: https://developer.apple.com/documentation/screencapturekit/scstreamerror/failedtostartaudiocapture An error message that indicates an audio stream failed to start. Available on Mac Catalyst 16.1+ and macOS 13.0+. ```APIDOC ## SCStreamError.Code.failedToStartAudioCapture ### Description An error message that indicates an audio stream failed to start. ### Availability Mac Catalyst 16.1+ macOS 13.0+ ### See Also * `SCStreamError.Code.attemptToStartStreamState` * `SCStreamError.Code.attemptToStopStreamState` * `SCStreamError.Code.attemptToUpdateFilterState` * `SCStreamError.Code.attemptToConfigState` * `SCStreamError.Code.failedToStart` * `SCStreamError.Code.failedToStopAudioCapture` * `SCStreamError.Code.failedToStartMicrophoneCapture` * `SCStreamError.Code.systemStoppedStream` * `SCStreamError.Code.internalError` * `SCStreamError.Code.removingStream` ``` -------------------------------- ### SCStreamFrameInfo Initializer Source: https://developer.apple.com/documentation/screencapturekit/scstreamframeinfo/init%28rawvalue%3A%29 Creates a new instance of SCStreamFrameInfo with a raw string value. Note: It is recommended to use static properties of SCStreamFrameInfo instead of creating instances with this initializer. ```APIDOC ## init(rawValue:) ### Description Creates a new instance with a raw value. ### Method Initializer ### Endpoint N/A (Initializer) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (N/A) None #### Response Example None ### Parameters `rawValue` (String) - The raw value to use for the new instance. ### Discussion Important Use the static properties of `SCStreamFrameInfo` such as `status` or `contentRect` instead of creating an instance with this initializer. ``` -------------------------------- ### Get contentRect Property Source: https://developer.apple.com/documentation/screencapturekit/scshareablecontentinfo/contentrect Retrieve the size and location of content for the stream. Available on Mac Catalyst 18.2+ and macOS 14.0+. ```swift var contentRect: CGRect { get } ``` -------------------------------- ### Initialize SCContentFilter with Specific Windows from a Display Source: https://developer.apple.com/documentation/screencapturekit/sccontentfilter/init%28desktopindependentwindow%3A%29 Creates a filter to capture only specific windows from a given display. Provide the display and an array of SCWindow objects to include. ```swift init(display: SCDisplay, including: [SCWindow]) ``` -------------------------------- ### Get Recorded File Size Source: https://developer.apple.com/documentation/screencapturekit/screcordingoutput/recordedfilesize Access the recordedFileSize property to retrieve the size of the recorded file in bytes. This property is read-only. ```swift var recordedFileSize: Int { get } ``` -------------------------------- ### Initialize Picker Configuration Source: https://developer.apple.com/documentation/screencapturekit/sccontentsharingpickerconfiguration-swift.struct/init%28%29 Initializes a picker configuration with default values. Available on Mac Catalyst 18.2+ and macOS 14.0+. ```swift init() ``` -------------------------------- ### Get Display Width in ScreenCaptureKit Source: https://developer.apple.com/documentation/screencapturekit/scdisplay/width Retrieve the width of an SCDisplay in points. Requires macOS 12.3+ or Mac Catalyst 18.2+. ```swift var width: Int { get } ``` -------------------------------- ### Retrieving Shareable Content Source: https://developer.apple.com/documentation/screencapturekit/scshareablecontent Methods to fetch available displays, applications, and windows for screen capture. ```APIDOC ## Retrieving Shareable Content ### `class func getWithCompletionHandler(_ completionHandler: (SCShareableContent?, (any Error)?) -> Void) Retrieves the displays, apps, and windows that your app can capture. ``` ```APIDOC ### `class func getExcludingDesktopWindows(_ excludeDesktopWindows: Bool, onScreenWindowsOnly: Bool, completionHandler: (SCShareableContent?, (any Error)?) -> Void) Retrieves the displays, apps, and windows that match your criteria. ``` ```APIDOC ### `class func getExcludingDesktopWindows(_ excludeDesktopWindows: Bool, onScreenWindowsOnlyAbove: SCWindow, completionHandler: (SCShareableContent?, (any Error)?) -> Void) Retrieves the displays, apps, and windows that are in front of the specified window. ``` ```APIDOC ### `class func getExcludingDesktopWindows(_ excludeDesktopWindows: Bool, onScreenWindowsOnlyBelow: SCWindow, completionHandler: (SCShareableContent?, (any Error)?) -> Void) Retrieves the displays, apps, and windows that are behind the specified window. ``` ```APIDOC ### `class func info(for contentFilter: SCContentFilter) -> SCShareableContentInfo Retrieves any available sharable content information that matches the provided filter. ``` ```APIDOC ### `class func getCurrentProcessShareableContent(completionHandler: (SCShareableContent?, (any Error)?) -> Void) Retrieves shareable content for the current process. ``` -------------------------------- ### SCStreamDelegate: Presenter Overlay Events Source: https://developer.apple.com/documentation/screencapturekit/scstreamdelegate Implement these methods to be notified when the Presenter Overlay starts or stops. These methods are part of the SCStreamDelegate protocol. ```swift func outputVideoEffectDidStart(for: SCStream) ``` ```swift func outputVideoEffectDidStop(for: SCStream) ``` -------------------------------- ### ScreenCaptureKit Initializer (Desktop Independent Window) Source: https://developer.apple.com/documentation/screencapturekit/sccontentfilter/init%28display%3Aexcludingapplications%3Aexceptingwindows%3A%29 Creates a filter that captures only the specified window. This is useful when you need to capture a single, specific window regardless of its display. ```swift init(desktopIndependentWindow: SCWindow) ``` -------------------------------- ### SCFrameStatus.started Source: https://developer.apple.com/documentation/screencapturekit/scframestatus/started A status that indicates the frame is the first one sent after the stream starts. Available on Mac Catalyst 18.2+ and macOS 12.3+. ```APIDOC ## SCFrameStatus.started ### Description A status that indicates the frame is the first one sent after the stream starts. ### Availability Mac Catalyst 18.2+ macOS 12.3+ ### Code Example ```swift case started ``` ### See Also * `case complete`: A status that indicates the system successfully generated a new frame. * `case idle`: A status that indicates the system didn’t generate a new frame because the display didn’t change. * `case blank`: A status that indicates the system didn’t generate a new frame because the display is blank. * `case suspended`: A status that indicates the system didn’t generate a new frame because you suspended updates. * `case stopped`: A status that indicates the frame is in a stopped state. ``` -------------------------------- ### Get Window ID Source: https://developer.apple.com/documentation/screencapturekit/scwindow/windowid Access the Core Graphics window identifier for a window. Requires macOS 12.3+ or Mac Catalyst 18.2+. ```swift var windowID: CGWindowID { get } ``` -------------------------------- ### getExcludingDesktopWindows(_:onScreenWindowsOnly:completionHandler:) Source: https://developer.apple.com/documentation/screencapturekit/scshareablecontent/getexcludingdesktopwindows%28_%3Aonscreenwindowsonly%3Acompletionhandler%3A%29 Retrieves the displays, apps, and windows that match your criteria, with options to exclude desktop windows and include only onscreen windows. ```APIDOC ## GET /websites/developer_apple_screencapturekit/getExcludingDesktopWindows ### Description Retrieves the displays, apps, and windows that match your criteria, with options to exclude desktop windows and include only onscreen windows. ### Method GET ### Endpoint /websites/developer_apple_screencapturekit/getExcludingDesktopWindows ### Parameters #### Query Parameters - **excludeDesktopWindows** (Boolean) - Required - A Boolean value that indicates whether to exclude desktop windows like Finder, Dock, and Desktop from the set of shareable content. - **onScreenWindowsOnly** (Boolean) - Required - A Boolean value that indicates whether to include only onscreen windows in the set of shareable content. ### Request Example ```json { "excludeDesktopWindows": true, "onScreenWindowsOnly": true } ``` ### Response #### Success Response (200) - **SCShareableContent** (object) - An instance of SCShareableContent containing the shareable content. #### Response Example ```json { "displays": [...], "apps": [...], "windows": [...] } ``` ``` -------------------------------- ### SCContentSharingPickerConfiguration Properties Source: https://developer.apple.com/documentation/screencapturekit/sccontentsharingpickerconfiguration-c.class Configuration options for the system content-sharing picker. ```APIDOC ## SCContentSharingPickerConfiguration An instance for configuring the system content-sharing picker. ### Topics #### Control streaming selections - `allowedPickerModes` (Array) - The content-selection modes supported by the picker. - `allowsChangingSelectedContent` (Boolean) - A Boolean value that indicates if the present stream can change to a different source. - `excludedBundleIDs` (Array) - A list of bundle IDs to exclude from the sharing picker. - `excludedWindowIDs` (Array) - A list of window IDs to exclude from the sharing picker. ``` -------------------------------- ### Get and Set presenterOverlayPrivacyAlertSetting Source: https://developer.apple.com/documentation/screencapturekit/scstreamconfiguration/presenteroverlayprivacyalertsetting Use this property to determine if alerts appear to presenters while using Presenter Overlay. The default value is SCPresenterOverlayAlertSetting.system. ```swift var presenterOverlayPrivacyAlertSetting: SCPresenterOverlayAlertSetting { get set } ``` -------------------------------- ### Get microphoneCaptureDeviceID Source: https://developer.apple.com/documentation/screencapturekit/scstreamconfiguration/microphonecapturedeviceid Access the microphoneCaptureDeviceID to retrieve the identifier of the microphone to be used for audio capture. This property is optional and returns a String if set. ```swift var microphoneCaptureDeviceID: String? { get set } ``` -------------------------------- ### Capture Screenshot with Completion Handler Source: https://developer.apple.com/documentation/screencapturekit/scscreenshotmanager/capturescreenshot%28rect%3Aconfiguration%3Acompletionhandler%3A%29 Use this method to capture a screenshot of a specified rectangular region using a completion handler. Provide the desired `CGRect` and `SCScreenshotConfiguration` to format the output. The result or any error will be delivered asynchronously. ```swift class func captureScreenshot( rect: CGRect, configuration config: SCScreenshotConfiguration, completionHandler: (@Sendable (SCScreenshotOutput?, (any Error)?) -> Void)? = nil ) ``` -------------------------------- ### Get and Set fileURL Property Source: https://developer.apple.com/documentation/screencapturekit/scscreenshotoutput/fileurl Use this property to specify the URL for saving the captured image. If fileURL is nil, the image is not saved. ```swift unowned(unsafe) var fileURL: NSURL? { get set } ```