---
title: "trimPrefix(while:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/collection/trimprefix(while:)"
---

# trimPrefix(while:)

## Declaration

```swift
mutating func trimPrefix(while predicate: (Self.Element) throws -> Bool) throws
```
