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

# ignoreOutput()

Ignores all upstream elements, but passes along the upstream publisher’s completion state (finished or failed).

## Declaration

```swift
func ignoreOutput() -> Publishers.IgnoreOutput<Self>
```

## Return Value

Return Value A publisher that ignores all upstream elements.

## Discussion

Discussion Use the ignoreOutput() operator to determine if a publisher is able to complete successfully or would fail. In the example below, the array publisher (numbers) delivers the first five of its elements successfully, as indicated by the ignoreOutput() operator. The operator consumes, but doesn’t republish the elements downstream. However, the sixth element, 0, causes the error throwing closure to catch a NoZeroValuesAllowedError that terminates the stream. struct NoZeroValuesAllowedError: Error {} let numbers = [1, 2, 3, 4, 5, 0, 6, 7, 8, 9] cancellable = numbers.publisher     .tryFilter({ anInt in         guard anInt != 0 else { throw NoZeroValuesAllowedError() }         return anInt < 20     })     .ignoreOutput()     .sink(receiveCompletion: {print("completion: \($0)")},           receiveValue: {print("value \($0)")})

// Prints: "completion: failure(NoZeroValuesAllowedError())" The output type of this publisher is Never.

## See Also

### Reducing elements

- [collect()](combine/publisher/collect().md)
- [collect(_:)](combine/publisher/collect(_:).md)
- [collect(_:options:)](combine/publisher/collect(_:options:).md)
- [Publishers.TimeGroupingStrategy](combine/publishers/timegroupingstrategy.md)
- [reduce(_:_:)](combine/publisher/reduce(_:_:).md)
- [tryReduce(_:_:)](combine/publisher/tryreduce(_:_:).md)
