<!--
{
  "availability" : [
    "macOS: 10.8.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSSharingServiceDelegate/sharingService(_:sourceWindowForShareItems:sharingContentScope:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSSharingServiceDelegate(im)sharingService:sourceWindowForShareItems:sharingContentScope:"
  },
  "title" : "sharingService(_:sourceWindowForShareItems:sharingContentScope:)"
}
-->

# sharingService(_:sourceWindowForShareItems:sharingContentScope:)

Returns the window that contained the share items.

```
@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 [`NSSharingService.SharingContentScope.item`](/documentation/AppKit/NSSharingService/SharingContentScope/item) by setting a different value in the out parameter `sharingContentScope`. See [`NSSharingService.SharingContentScope`](/documentation/AppKit/NSSharingService/SharingContentScope) for supported values.

## Return Value

The window of the shared items.

## 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.

```objc
- (NSWindow *)sharingService:(NSSharingService *)sharingService
              sourceWindowForShareItems:(NSArray *)items
              sharingContentScope:(NSSharingContentScope *)sharingContentScope
{
    *sharingContentScope = NSSharingContentScopeItem;
    return [_imageView window];
}
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)