---
title: "flatMap(_:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/lazymapsequence/flatmap(_:)-q9wd"
---

# flatMap(_:)

Returns the concatenated results of mapping the given transformation over this sequence.

## Declaration

```swift
func flatMap<SegmentOfResult>(_ transform: @escaping (Self.Elements.Element) -> SegmentOfResult) -> LazySequence<FlattenSequence<LazyMapSequence<Self.Elements, SegmentOfResult>>> where SegmentOfResult : Sequence
```

## Discussion

Discussion Use this method to receive a single-level sequence when your transformation produces a sequence or collection for each element. Calling flatMap(_:) on a sequence s is equivalent to calling s.map(transform).joined(). note: O(1)
