---
title: popFirst()
framework: swift
role: symbol
role_heading: Instance Method
path: swift/substring/popfirst()
---

# popFirst()

Removes and returns the first element of the collection.

## Declaration

```swift
mutating func popFirst() -> Self.Element?
```

## Return Value

Return Value The first element of the collection if the collection is not empty; otherwise, nil.

## Discussion

Discussion note: O(1)
