---
title: prefix()
framework: swift
role: symbol
role_heading: Instance Method
path: swift/utf8span/unicodescalariterator/prefix()
---

# prefix()

Returns the UTF8Span containing all the content up to the iterator’s current position.

## Declaration

```swift
func prefix() -> UTF8Span
```

## Discussion

Discussion The resultant UTF8Span has the same lifetime constraints as self. note: O(1)
