<!--
{
  "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" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/currentEntitlementTask(for:priority:action:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI",
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewP010_StoreKit_aB0E22currentEntitlementTask3for8priority6actionQrSS_ScPyAD0gH5StateOy0dE018VerificationResultOyAK11TransactionVGSgGYactF"
  },
  "title" : "currentEntitlementTask(for:priority:action:)"
}
-->

# currentEntitlementTask(for:priority:action:)

Declares the view as dependent on the entitlement of an In-App Purchase product, and returns a
modified view.

```
nonisolated func currentEntitlementTask(for productID: String, priority: TaskPriority = .medium, action: @escaping (EntitlementTaskState<VerificationResult<Transaction>?>) async -> ()) -> some View
```

## Parameters

`productID`

The product ID to get the entitlement for. The task restarts whenever this
parameter changes.

`priority`

The task priority to use when creating the task.

`action`

The action to perform when the task’s state changes.

## Discussion

Before a view modified with this method appears, a task will start in the background to get the
current entitlement. While the view is presented, the task will call `action` whenever the
entitlement changes or the task’s state changes.

Consumable in-app purchases will always pass `nil` to `action`.
For auto-renewable subscriptions, use
`subscriptionStatusTask(for:priority:action:)` to get the full status
information for the subscription.

---

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)