---
title: "requestSharingOfWindow(usingPreview:title:completionHandler:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nswindow/requestsharingofwindow(usingpreview:title:completionhandler:)"
---

# requestSharingOfWindow(usingPreview:title:completionHandler:)

## Declaration

```swift
func requestSharingOfWindow(usingPreview image: NSImage, title: String, completionHandler: @escaping ((any Error)?) -> Void)
```

```swift
func requestSharingOfWindow(usingPreview image: NSImage, title: String) async throws
```

## Parameters

- `image`: An image showing a preview of the window to share
- `title`: The title to show in a confirmation dialog
- `completionHandler`: A completion block that is called after the request finishes.

## Discussion

Discussion Request sharing of window to be provided later.  If there is an available ScreenCaptureKit sharing session, an alert will be presented asking the user to confirm the share.  The delegate will be asked to provide the window to share via windowForSharingRequestFromWindow: 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.
