---
title: "init(forServiceType:)"
framework: social
role: symbol
role_heading: Initializer
path: "social/slcomposeviewcontroller/init(forservicetype:)"
---

# init(forServiceType:)

Creates a new social compose view controller.

## Declaration

```swift
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 doc://com.apple.social/documentation/Social/SLComposeViewController/serviceType. If an invalid serviceType is passed in, this method throws an exception.

## Return Value

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

## Discussion

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