<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "StoreKit",
  "identifier" : "/documentation/StoreKit/EntitlementTaskState",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "StoreKit",
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:17_StoreKit_SwiftUI20EntitlementTaskStateO"
  },
  "title" : "EntitlementTaskState"
}
-->

# EntitlementTaskState

The state of an entitlement task.

```
enum EntitlementTaskState<Value>
```

## Overview

To get an entitlement task state, use <doc://com.apple.documentation/documentation/SwiftUI/View/currentEntitlementTask(for:priority:action:)> or <doc://com.apple.documentation/documentation/SwiftUI/View/subscriptionStatusTask(for:priority:action:)> on a <doc://com.apple.documentation/documentation/SwiftUI/View>.

## Topics

### Getting the task state

[`case loading`](/documentation/StoreKit/EntitlementTaskState/loading)

The task is loading the entitlement in the background.

[`case success(Value)`](/documentation/StoreKit/EntitlementTaskState/success(_:))

The task successfully loaded the entitlement.

[`case failure(any Error)`](/documentation/StoreKit/EntitlementTaskState/failure(_:))

The task failed to load the entitlement, with an error.

### Getting the transaction with the entitlement

[`var transaction: VerificationResult<Transaction>?`](/documentation/StoreKit/EntitlementTaskState/transaction)

The transaction value if the task is successful.

[`var value: Value?`](/documentation/StoreKit/EntitlementTaskState/value)

The entitlement value if the task is successful.

### Helper methods

[`func flatMap<NewValue>((Value) throws -> EntitlementTaskState<NewValue>) rethrows -> EntitlementTaskState<NewValue>`](/documentation/StoreKit/EntitlementTaskState/flatMap(_:)-7gsnv)

Returns a new state, mapping the entitlement value if successful.

[`func flatMap<NewValue>((Value) async throws -> EntitlementTaskState<NewValue>) async rethrows -> EntitlementTaskState<NewValue>`](/documentation/StoreKit/EntitlementTaskState/flatMap(_:)-66eb8)

Returns a new state, mapping the entitlement value if successful.

[`func map<NewValue>((Value) throws -> NewValue) rethrows -> EntitlementTaskState<NewValue>`](/documentation/StoreKit/EntitlementTaskState/map(_:)-8ly3v)

Returns a new state, mapping the entitlement value if successful.

[`func map<NewValue>((Value) async throws -> NewValue) async rethrows -> EntitlementTaskState<NewValue>`](/documentation/StoreKit/EntitlementTaskState/map(_:)-250dk)

Returns a new state, mapping the entitlement value if successful.

## Relationships

### Conforms To

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Sendable`](/documentation/Swift/Sendable)

---

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)