---
title: "init(_:)"
framework: swift
role: symbol
role_heading: Initializer
path: "swift/string/init(_:)-expd"
---

# init(_:)

Creates a String having the given content.

## Declaration

```swift
init?(_ codeUnits: Substring.UTF16View)
```

## Discussion

Discussion If codeUnits is an ill-formed code unit sequence, the result is nil. note: O(N), where N is the length of the resulting String’s UTF-16.

## See Also

### Working with String Views

- [unicodeScalars](swift/string/unicodescalars.md)
- [init(_:)](swift/string/init(_:)-2t931.md)
- [init(_:)](swift/string/init(_:)-11jx3.md)
- [utf16](swift/string/utf16.md)
- [init(_:)](swift/string/init(_:)-wbcx.md)
- [utf8](swift/string/utf8.md)
- [init(_:)](swift/string/init(_:)-6sprj.md)
- [init(_:)](swift/string/init(_:)-83bub.md)
