---
title: utf8Span
framework: swift
role: symbol
role_heading: Instance Property
path: swift/string/utf8span
---

# utf8Span

A UTF-8 span over the code units that make up this string.

## Declaration

```swift
var utf8Span: UTF8Span { get }
```

## Return Value

Return Value A UTF8Span over the code units of this string.

## Discussion

Discussion note: In the case of bridged UTF-16 string instances (on Apple platforms) this property transcodes the code units the first time it’s called. The transcoded buffer is cached, and subsequent calls can reuse the buffer. note: O(1) for native UTF-8 strings, amortized O(1) for bridged UTF-16 strings.
