---
title: "sharingService(_:sourceFrameOnScreenForShareItem:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nssharingservicedelegate/sharingservice(_:sourceframeonscreenforshareitem:)"
---

# sharingService(_:sourceFrameOnScreenForShareItem:)

Invoked when the sharing service is performed and the sharing window is displayed, to present a transition between the original items and the sharing window.

## Declaration

```swift
@MainActor optional func sharingService(_ sharingService: NSSharingService, sourceFrameOnScreenForShareItem item: Any) -> NSRect
```

## Parameters

- `sharingService`: The sharing service.
- `item`: The item being shared.

## Return Value

Return Value The rectangle, in screen coordinates, to display the transition.

## Discussion

Discussion The following is an example implementation of this method: - (NSRect)sharingService:(NSSharingService *)sharingService sourceFrameOnScreenForShareItem:(id <NSPasteboardWriting>)item {     if ([item isKindOfClass:[NSImage class]]) {         NSImage * image = [_imageView image];         NSRect frame = [_imageView bounds];         frame = [_imageView convertRect:frame toView:nil];         frame.origin = [[_imageView window] convertBaseToScreen:frame.origin];         return frame;     }     return NSZeroRect; }

## See Also

### Customizing Transition Animation

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