<!--
{
  "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" : "Swift",
  "identifier" : "/documentation/Swift/Result/publisher-swift.property",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:s6ResultO7CombineE9publisherAbCE9PublisherVyxq__Gvp"
  },
  "title" : "publisher"
}
-->

# publisher

A Combine publisher that publishes this instance’s result to each subscriber exactly once, or fails immediately if the result indicates failure.

```
var publisher: Result<Success, Failure>.Publisher { get }
```

## Discussion

In the following example, `goodResult` provides a successful result with the integer value `1`. A sink subscriber connected to the result’s publisher receives the output `1`, followed by a normal completion (<doc://com.apple.documentation/documentation/Combine/Subscribers/Completion/finished>).

```
 let goodResult: Result<Int, MyError> = .success(1)
 goodResult.publisher
     .sink(receiveCompletion: { print("goodResult done: \($0)")},
           receiveValue: { print("goodResult value: \($0)")} )
 // Prints:
 // goodResult value: 1
 // goodResult done: finished
```

In contrast with the <doc://com.apple.documentation/documentation/Combine/Just> publisher, which always publishes a single value, this publisher might not send any values and instead terminate with an error, if the result is `/Swift/Result/failure`. In the next example, `badResult` is a failure result that wraps a custom error. A sink subscriber connected to this result’s publisher immediately receives a termination (<doc://com.apple.documentation/documentation/Combine/Subscribers/Completion/failure(_:)>).

```
 struct MyError: Error, CustomDebugStringConvertible {
     var debugDescription: String = "MyError"
 }
 let badResult: Result<Int, MyError> = .failure(MyError())
 badResult.publisher
     .sink(receiveCompletion: { print("badResult done: \($0)")},
           receiveValue: { print("badResult value: \($0)")} )
 // Prints:
 // badResult done: failure(MyError)
```

---

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)