---
title: "viewController(for:)"
framework: mailkit
role: symbol
role_heading: Instance Method
path: "mailkit/mecomposesessionhandler/viewcontroller(for:)"
---

# viewController(for:)

Provides a custom view controller to display as part of the compose window.

## Declaration

```swift
func viewController(for session: MEComposeSession) -> MEExtensionViewController
```

## Parameters

- `session`: The session that represents the properties of the message in the compose window.

## Return Value

Return Value A custom MEExtensionViewController subclass that Mail displays in the compose window.

## Discussion

Discussion To configure an icon and tooltip for the compose session handler’s view controller, add the following entries to your extension’s Info.plist file: <key>NSExtensionAttributes</key> <dict>     <key>MEComposeSession</key>     <dict>         <key>MEComposeIcon</key>         <string>YourCustomComposeIconName</string>         <key>MEComposeIconToolTip</key>         <string>Tooltip for the compose session handler.</string>     </dict> <dict> Include an icon in your extension’s bundle using the name you specify for MEComposeIcon. tip: Include the icon in an asset catalog in your extension’s bundle, and include both light and dark variants.
