---
title: "activityViewController(_:subjectForActivityType:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uiactivityitemsource/activityviewcontroller(_:subjectforactivitytype:)"
---

# activityViewController(_:subjectForActivityType:)

For activities that support a subject field, returns the subject for the item.

## Declaration

```swift
optional func activityViewController(_ activityViewController: UIActivityViewController, subjectForActivityType activityType: UIActivity.ActivityType?) -> String
```

## Parameters

- `activityViewController`: The activity view controller object requesting information about the data item.
- `activityType`: The selected activity type; may be nil.

## Return Value

Return Value A string to use as the contents of the subject field.

## Discussion

Discussion When posting an item the service may provide for a separate subject field and data field, such as an email message. Implement this method if you wish to provide a subject field for services that support one.

## See Also

### Providing information about the data items

- [activityViewController(_:dataTypeIdentifierForActivityType:)](uikit/uiactivityitemsource/activityviewcontroller(_:datatypeidentifierforactivitytype:).md)
- [activityViewController(_:thumbnailImageForActivityType:suggestedSize:)](uikit/uiactivityitemsource/activityviewcontroller(_:thumbnailimageforactivitytype:suggestedsize:).md)
