---
title: "prepend(_:)"
framework: combine
role: symbol
role_heading: Instance Method
path: "combine/publisher/prepend(_:)-5dj9c"
---

# prepend(_:)

Prefixes the output of this publisher with the elements emitted by the given publisher.

## Declaration

```swift
func prepend<P>(_ publisher: P) -> Publishers.Concatenate<P, Self> where P : Publisher, Self.Failure == P.Failure, Self.Output == P.Output
```

## Parameters

- `publisher`: The prefixing publisher.

## Return Value

Return Value A publisher that prefixes the prefixing publisher’s elements prior to this publisher’s elements.

## Discussion

Discussion Use prepend(_:) to publish values from two publishers when you need to prepend one publisher’s elements to another. In the example below, a publisher of prefixValues publishes its elements before the dataElements publishes its elements: let prefixValues = [0, 1, 255] let dataElements = (0...10) cancellable = dataElements.publisher     .prepend(prefixValues.publisher)     .sink { print("\($0)", terminator: " ") }

// Prints: "0 1 255 0 1 2 3 4 5 6 7 8 9 10"

## See Also

### Applying sequence operations to elements

- [drop(untilOutputFrom:)](combine/publisher/drop(untiloutputfrom:).md)
- [dropFirst(_:)](combine/publisher/dropfirst(_:).md)
- [drop(while:)](combine/publisher/drop(while:).md)
- [tryDrop(while:)](combine/publisher/trydrop(while:).md)
- [append(_:)](combine/publisher/append(_:)-1qb8d.md)
- [append(_:)](combine/publisher/append(_:)-69sdn.md)
- [append(_:)](combine/publisher/append(_:)-5yh02.md)
- [prepend(_:)](combine/publisher/prepend(_:)-7wk5l.md)
- [prepend(_:)](combine/publisher/prepend(_:)-v9sb.md)
- [prefix(_:)](combine/publisher/prefix(_:).md)
- [prefix(while:)](combine/publisher/prefix(while:).md)
- [tryPrefix(while:)](combine/publisher/tryprefix(while:).md)
- [prefix(untilOutputFrom:)](combine/publisher/prefix(untiloutputfrom:).md)
