---
title: first()
framework: combine
role: symbol
role_heading: Instance Method
path: combine/publisher/first()
---

# first()

Publishes the first element of a stream, then finishes.

## Declaration

```swift
func first() -> Publishers.First<Self>
```

## Return Value

Return Value A publisher that only publishes the first element of a stream.

## Discussion

Discussion Use first() to publish just the first element from an upstream publisher, then finish normally. The first() operator requests unlimited from its upstream as soon as downstream requests at least one element. If the upstream completes before first() receives any elements, it completes without emitting any values. In this example, the first() publisher republishes the first element received from the sequence publisher, -10, then finishes normally. let numbers = (-10...10) cancellable = numbers.publisher     .first()     .sink { print("\($0)") }

// Print: "-10"

## See Also

### Selecting specific elements

- [first(where:)](combine/publisher/first(where:).md)
- [tryFirst(where:)](combine/publisher/tryfirst(where:).md)
- [last()](combine/publisher/last().md)
- [last(where:)](combine/publisher/last(where:).md)
- [tryLast(where:)](combine/publisher/trylast(where:).md)
- [output(at:)](combine/publisher/output(at:).md)
- [output(in:)](combine/publisher/output(in:).md)
