---
title: "init(stringInterpolation:)"
framework: swift
role: symbol
role_heading: Initializer
path: "swift/string/init(stringinterpolation:)-62d9"
---

# init(stringInterpolation:)

Creates a new instance from an interpolated string literal.

## Declaration

```swift
init(stringInterpolation: DefaultStringInterpolation)
```

## Discussion

Discussion Don’t call this initializer directly. It’s used by the compiler when you create a string using string interpolation. Instead, use string interpolation to create a new string by including values, literals, variables, or expressions enclosed in parentheses, prefixed by a backslash (\(…)). let price = 2 let number = 3 let message = """               If one cookie costs \(price) dollars, \               \(number) cookies cost \(price * number) dollars.               """ // message == "If one cookie costs 2 dollars, 3 cookies cost 6 dollars."
