<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/Result",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:s6ResultO"
  },
  "title" : "Result"
}
-->

# Result

A value that represents either a success or a failure, including an
associated value in each case.

```
@frozen enum Result<Success, Failure> where Failure : Error, Success : ~Copyable, Success : ~Escapable
```

## Topics

### Representing a Result

[`Result.success(_:)`](/documentation/Swift/Result/success(_:))

A success, storing a `Success` value.

[`Result.failure(_:)`](/documentation/Swift/Result/failure(_:))

A failure, storing a `Failure` value.

  <doc://com.apple.Swift/documentation/Swift/writing-failable-asynchronous-apis>

### Converting a Throwing Expression to a Result

  <doc://com.apple.Swift/documentation/Swift/preserving-the-results-of-a-throwing-expression>

### Converting a Result to a Throwing Expression

[`get()`](/documentation/Swift/Result/get())

Returns the success value as a throwing expression.

### Transforming a Result

[`map(_:)`](/documentation/Swift/Result/map(_:))

Returns a new result, mapping any success value using the given
transformation.

[`mapError(_:)`](/documentation/Swift/Result/mapError(_:))

Returns a new result, mapping any failure value using the given
transformation.

[`flatMap(_:)`](/documentation/Swift/Result/flatMap(_:))

Returns a new result, mapping any success value using the given
transformation and unwrapping the produced result.

[`flatMapError(_:)`](/documentation/Swift/Result/flatMapError(_:))

Returns a new result, mapping any failure value using the given
transformation and unwrapping the produced result.

### Comparing Results

[`==(_:_:)`](/documentation/Swift/Result/==(_:_:))

Returns a Boolean value indicating whether two values are equal.

[`!=(_:_:)`](/documentation/Swift/Result/!=(_:_:))

Returns a Boolean value indicating whether two values are not equal.

### Publishing a Result

[`publisher`](/documentation/Swift/Result/publisher-swift.property)

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

[`Result.Publisher`](/documentation/Swift/Result/Publisher-swift.struct)

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



---

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)