<!--
{
  "availability" : [
    "iOS: 6.0.0 -",
    "iPadOS: 6.0.0 -",
    "macCatalyst: 13.1.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Social",
  "identifier" : "/documentation/Social/SLComposeViewController",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Social"
    ],
    "preciseIdentifier" : "c:objc(cs)SLComposeViewController"
  },
  "title" : "SLComposeViewController"
}
-->

# SLComposeViewController

A view controller that allows the user to compose social media posts.

```
class SLComposeViewController
```

## Overview

Use the [`isAvailable(forServiceType:)`](/documentation/Social/SLComposeViewController/isAvailable(forServiceType:)) class method to check if a service account, such as Twitter, is set up and reachable before presenting this view to the user.

Set the initial content before presenting the view controller to the user. All the methods that set the content of a post return a Boolean value. They return <doc://com.apple.documentation/documentation/Swift/false> if the content doesn’t fit in the post or if the view controller has already been presented to the user. You must set all of the content in the post before presenting the view controller to the user. After presenting the view controller, only the user can edit the post.

You can set a handler—using the [`completionHandler`](/documentation/Social/SLComposeViewController/completionHandler) property—to be notified when the user is done composing a post. Note that completion handlers are not called on any particular thread.

## Topics

### Creating a Social Compose View Controller

[`init(forServiceType:)`](/documentation/Social/SLComposeViewController/init(forServiceType:))

Creates a new social compose view controller.

### Checking the Social Service Type

[`isAvailable(forServiceType:)`](/documentation/Social/SLComposeViewController/isAvailable(forServiceType:))

Returns A Boolean value that indicates whether you can send a request for a particular service type.

[`serviceType`](/documentation/Social/SLComposeViewController/serviceType)

Specifies the social-networking service.

### Specifying the Contents of the Post

[`setInitialText(_:)`](/documentation/Social/SLComposeViewController/setInitialText(_:))

Sets the initial text to be posted.

[`add(_:)`](/documentation/Social/SLComposeViewController/add(_:)-1z68a)

Adds an image to the post.

[`add(_:)`](/documentation/Social/SLComposeViewController/add(_:)-3mn1w)

Adds a URL to the post.

[`removeAllImages()`](/documentation/Social/SLComposeViewController/removeAllImages())

Removes all images from the post.

[`removeAllURLs()`](/documentation/Social/SLComposeViewController/removeAllURLs())

Removes all URLs from the post.

### Processing the Results

[`completionHandler`](/documentation/Social/SLComposeViewController/completionHandler)

The handler to call when the user is done composing a post.

[`SLComposeViewControllerCompletionHandler`](/documentation/Social/SLComposeViewControllerCompletionHandler)

Defines a handler to call when the user finishes composing a post.

[`SLComposeViewControllerResult`](/documentation/Social/SLComposeViewControllerResult)

Possible values for the `result` parameter of the [`completionHandler`](/documentation/Social/SLComposeViewController/completionHandler) property.



---

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)