---
title: "flatMap(_:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/reversedcollection/flatmap(_:)-81zng"
---

# flatMap(_:)

Returns the non-nil results of mapping the given transformation over this sequence.

## Declaration

```swift
func flatMap<ElementOfResult>(_ transform: @escaping (Self.Elements.Element) -> ElementOfResult?) -> LazyMapSequence<LazyFilterSequence<LazyMapSequence<Self.Elements, ElementOfResult?>>, ElementOfResult>
```

## Parameters

- `transform`: A closure that accepts an element of this sequence as its argument and returns an optional value.

## Discussion

Discussion Use this method to receive a sequence of non-optional values when your transformation produces an optional value. note: O(1)
