<!--
{
  "availability" : [
    "iOS: 7.0.0 -",
    "iPadOS: 7.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIActivityItemSource/activityViewController(_:subjectForActivityType:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UIActivityItemSource(im)activityViewController:subjectForActivityType:"
  },
  "title" : "activityViewController(_:subjectForActivityType:)"
}
-->

# activityViewController(_:subjectForActivityType:)

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

```
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

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

## 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.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)