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

# previous()

Decode and return the scalar ending at currentCodeUnitOffset. After the function returns, currentCodeUnitOffset holds the position at the start of the returned scalar, which is also the end of the previous scalar.

## Declaration

```swift
mutating func previous() -> Unicode.Scalar?
```

## Discussion

Discussion Returns nil if at the start of the UTF8Span. note: O(1)
