Contents

requestSharingOfWindow(_:completionHandler:)

Declaration

func requestSharingOfWindow(_ window: NSWindow, completionHandler: @escaping ((any Error)?) -> Void)
func requestSharingOfWindow(_ window: NSWindow) async throws

Parameters

  • window:

    The window to share

  • completionHandler:

    A completion block that is called after the request finishes.

Discussion

Request sharing of window. If there is an available ScreenCaptureKit sharing session, an alert will be presented asking the user to confirm the share

The error will be non-nil if the request does not result in a window being shared. The error will be NSUserCancelledError if there is no ScreenCaptureKit session, or if the user rejects the offer to share. If sharing fails for some other reason, the error will provide the details.