---
title: "sharingService(_:transitionImageForShareItem:contentRect:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nssharingservicedelegate/sharingservice(_:transitionimageforshareitem:contentrect:)"
---

# sharingService(_:transitionImageForShareItem:contentRect:)

Invoked to allow returning a custom transition image when sharing an item.

## Declaration

```swift
@MainActor optional func sharingService(_ sharingService: NSSharingService, transitionImageForShareItem item: Any, contentRect: UnsafeMutablePointer<NSRect>) -> NSImage?
```

## Parameters

- `sharingService`: The sharing service.
- `item`: The shared item.
- `contentRect`: The content rectangle is the frame of the actual content inside the transition image, excluding all decorations. For example, if the transition image is a QuickLook thumbnail, the value would be QLThumbnailGetContentRect.

## Return Value

Return Value The image to display for the sharing transition. Its size should exactly match that of the original image.

## Discussion

Discussion A sample implementation of this method: - (NSImage *)sharingService:(NSSharingService *)sharingService              transitionImageForShareItem:(id <NSPasteboardWriting>)item              contentRect:(NSRect *)contentRect {     if ([item isKindOfClass:[NSImage class]]) {         return [_imageView image];     } }

## See Also

### Customizing Transition Animation

- [sharingService(_:sourceFrameOnScreenForShareItem:)](appkit/nssharingservicedelegate/sharingservice(_:sourceframeonscreenforshareitem:).md)
- [sharingService(_:sourceWindowForShareItems:sharingContentScope:)](appkit/nssharingservicedelegate/sharingservice(_:sourcewindowforshareitems:sharingcontentscope:).md)
- [NSSharingService.SharingContentScope](appkit/nssharingservice/sharingcontentscope.md)
