<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Combine",
  "identifier" : "/documentation/Combine/Publisher/ignoreOutput()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Combine"
    ],
    "preciseIdentifier" : "s:7Combine9PublisherPAAE12ignoreOutputAA10PublishersO06IgnoreD0Vy_xGyF"
  },
  "title" : "ignoreOutput()"
}
-->

# ignoreOutput()

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

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

## Return Value

A publisher that ignores all upstream elements.

## Discussion

Use the [`ignoreOutput()`](/documentation/Combine/Publisher/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()`](/documentation/Combine/Publisher/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 <doc://com.apple.documentation/documentation/Swift/Never>.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)