---
title: "sharingService(_:sourceWindowForShareItems:sharingContentScope:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nssharingservicedelegate/sharingservice(_:sourcewindowforshareitems:sharingcontentscope:)"
---

# sharingService(_:sourceWindowForShareItems:sharingContentScope:)

Returns the window that contained the share items.

## Declaration

```swift
@MainActor optional func sharingService(_ sharingService: NSSharingService, sourceWindowForShareItems items: [Any], sharingContentScope: UnsafeMutablePointer<NSSharingService.SharingContentScope>) -> NSWindow?
```

## Parameters

- `sharingService`: The sharing service.
- `items`: The items being shared.
- `sharingContentScope`: The sharing content scope. The sharing scope can be modified from the default value of doc://com.apple.appkit/documentation/AppKit/NSSharingService/SharingContentScope/item by setting a different value in the out parameter sharingContentScope. See doc://com.apple.appkit/documentation/AppKit/NSSharingService/SharingContentScope for supported values.

## Return Value

Return Value The window of the shared items.

## Discussion

Discussion The following is an example implementation of this method. It changes the item scope, and returns the window the source image view is contained within. - (NSWindow *)sharingService:(NSSharingService *)sharingService               sourceWindowForShareItems:(NSArray *)items               sharingContentScope:(NSSharingContentScope *)sharingContentScope {     *sharingContentScope = NSSharingContentScopeItem;     return [_imageView window]; }

## See Also

### Customizing Transition Animation

- [sharingService(_:sourceFrameOnScreenForShareItem:)](appkit/nssharingservicedelegate/sharingservice(_:sourceframeonscreenforshareitem:).md)
- [sharingService(_:transitionImageForShareItem:contentRect:)](appkit/nssharingservicedelegate/sharingservice(_:transitionimageforshareitem:contentrect:).md)
- [NSSharingService.SharingContentScope](appkit/nssharingservice/sharingcontentscope.md)
