---
title: Publishers.FlatMap
framework: combine
role: symbol
role_heading: Structure
path: combine/publishers/flatmap
---

# Publishers.FlatMap

A publisher that transforms elements from an upstream publisher into a new publisher.

## Declaration

```swift
struct FlatMap<NewPublisher, Upstream> where NewPublisher : Publisher, Upstream : Publisher, NewPublisher.Failure == Upstream.Failure
```

## Topics

### Creating a flat map Publisher

- [init(upstream:maxPublishers:transform:)](combine/publishers/flatmap/init(upstream:maxpublishers:transform:).md)

### Declaring supporting types

- [Publishers.FlatMap.Output](combine/publishers/flatmap/output.md)
- [Publishers.FlatMap.Failure](combine/publishers/flatmap/failure.md)

### Inspecting publisher properties

- [upstream](combine/publishers/flatmap/upstream.md)
- [maxPublishers](combine/publishers/flatmap/maxpublishers.md)
- [transform](combine/publishers/flatmap/transform.md)

## Relationships

### Conforms To

- [Publisher](combine/publisher.md)

## See Also

### Republishing elements by subscribing to new publishers

- [Publishers.SwitchToLatest](combine/publishers/switchtolatest.md)
