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

# init(forServiceType:)

Creates a new social compose view controller.

```
init!(forServiceType serviceType: String!)
```

## Parameters

`serviceType`

This specifies the social networking service to which you want to post. You must use one of the possible values listed in Service Type Constants. This also sets the value of [`serviceType`](/documentation/Social/SLComposeViewController/serviceType). If an invalid `serviceType` is passed in, this method throws an exception.

## Return Value

Returns a social compose view controller or `nil` if an error occurs.

## Discussion

Use this method to create a social compose view controller. Do not use any other methods.

---

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)