---
title: "filter(_:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/slice/filter(_:)-7stzr"
---

# filter(_:)

Returns the elements of self that satisfy isIncluded.

## Declaration

```swift
func filter(_ isIncluded: @escaping (Self.Elements.Element) -> Bool) -> LazyFilterSequence<Self.Elements>
```

## Discussion

Discussion note: The elements of the result are computed on-demand, as the result is used. No buffering storage is allocated and each traversal step invokes predicate on one or more underlying elements.
