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

# subscriptionStatusTask(for:priority:action:)

Declares the view as dependent on the status of an auto-renewable subscription group, and
returns a modified view.

```
nonisolated func subscriptionStatusTask(for groupID: String, priority: TaskPriority = .medium, action: @escaping (EntitlementTaskState<[Product.SubscriptionInfo.Status]>) async -> ()) -> some View
```

## Parameters

`groupID`

The subscription group ID to get the status 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 subscription status. While the view is presented, the task will call `action` whenever
the status changes or the task’s state changes.

---

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)