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

# last()

Publishes the last element of a stream, after the stream finishes.

## Declaration

```swift
func last() -> Publishers.Last<Self>
```

## Return Value

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

## Discussion

Discussion Use last() when you need to emit only the last element from an upstream publisher. In the example below, the range publisher only emits the last element from the sequence publisher, 10, then finishes normally. let numbers = (-10...10) cancellable = numbers.publisher     .last()     .sink { print("\($0)") }

// Prints: "10"

## See Also

### Selecting specific elements

- [first()](combine/publisher/first().md)
- [first(where:)](combine/publisher/first(where:).md)
- [tryFirst(where:)](combine/publisher/tryfirst(where:).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)
