---
title: "init(title:image:alternateImage:handler:)"
framework: appkit
role: symbol
role_heading: Initializer
path: "appkit/nssharingservice/init(title:image:alternateimage:handler:)"
---

# init(title:image:alternateImage:handler:)

Creates a custom sharing service object.

## Declaration

```swift
init(title: String, image: NSImage, alternateImage: NSImage?, handler block: @escaping () -> Void)
```

## Parameters

- `title`: The custom sharing service name.
- `image`: The image that represents the sharing service
- `alternateImage`: The alternate image that represents the sharing service
- `block`: The block that actually interacts with the service.

## Return Value

Return Value An instance of the custom sharing object.

## Discussion

Discussion Custom sharing services can be added to the NSSharingServicePicker with the sharingServicePicker(_:sharingServicesForItems:proposedSharingServices:) delegate method. When implementing this method, consider subclassing NSSharingService so the canPerform(withItems:) and sharingServices(forItems:) can provide accurate results.

## See Also

### Creating a Sharing Service

- [init(named:)](appkit/nssharingservice/init(named:).md)
- [NSSharingService.Name](appkit/nssharingservice/name.md)
