One Logo Pool Ball
_StoreKit_SwiftUI · IOS API REFERENCE

SubscriptionStoreView

struct · iOS 17.0+ · SDK 27.1

@MainActor @preconcurrency struct SubscriptionStoreView<Content> where Content : View

A view that merchandises a collection of subscription options in a subscription group. There are three ways to create a subscription group: + Providing a subscription group identifier + Providing a collection of product identifiers + Providing a collection of product values you already loaded from the App Store If you provide a subscription group identifier, or product identifiers, the subscription store automatically loads the subscription data from the App Store, and updates the view when the data is available. By default, the subscription store creates automatic marketing content based on your app and subscriptions. You can provide a custom view to market your subscription by using an initializer with a `marketingContent` parameter. The subscription store does not draw a background by default, so you can use a modifier like ``background(alignment:content:)`` to layer a background behind the view. You can use the ``containerBackground(_:for:)`` or ``containerBackground(for:alignment:content:)`` view modifier with a ``SwiftUI/ContainerBackgroundPlacement`` like ``SwiftUI/ContainerBackgroundPlacement/subscriptionStoreHeader`` to set the container background of the subscription store using a view. You can optionally provide a view as a decorative icon next to each subscription option. Use the ``subscriptionStoreControlIcon(icon:)-dchx`` view modifier to set a view to use to decorate individual subscription options within a subscription store. ### Ordering & filtering subscriptions If you provide a subscription group identifier, the system will order the subscription options according to their rank. If someone is already subscribed, you may want to merchandise an upgrade or crossgrade option. By default, the subscription store merchandises all products in the group, but if you provide a `visibleRelationships` parameter, you can choose to hide certain options relative to the active subscription option. If you use one of the other initializers, the subscriptions will be ordered according to the collection parameter's order. Any subscriptions that aren't included in the collection parameter will be excluded. ### Terms of service & privacy policy The subscription store automatically displays buttons for the terms of service and privacy policy submitted with the App Store metadata. You may want to override the destination of these buttons with a URL to a custom terms of service and privacy policy page, or a custom view. You can do this using a modifier like ``subscriptionStorePolicyDestination(url:for:)-5hqba`` and ``subscriptionStorePolicyDestination(for:destination:)-zvev``, respectively. If the automatic style of these buttons is difficult to read against your store's background, you can use a modifier like ``subscriptionStorePolicyForegroundStyle(_:)`` and ``subscriptionStorePolicyForegroundStyle(_:_:)`` to customize the button's style. ### Configuring the subscription store In addition to the various initializers, you can further configure the subscription store using various view modifiers. You can specify the visibility of certain kinds of auxiliary buttons within the subscription store with the ``storeButton(_:for:)-29wie`` view modifier. If your subscription is available through other services, the subscription store can show a sign in button. The sign in button allows you to implement a custom sign in flow to support people who are already subscribed. Use the ``subscriptionStoreSignInAction(_:)-120ig`` modifier to set a function to be called when someone uses the sign in button. When the subscription store is being presented, it will show a close button automatically. You can override this behavior to unconditionally show or hide the close button using the ``storeButton(_:for:)-29wie`` modifier. ### Styling the subscription store You can further customize the subscription store's appearance using various control styles. Subscription store control styles allow you to customize how subscription options are displayed, and how people are able to interact with your store. You can try out standard styles, like ``SubscriptionStoreControlStyle/buttons``, by applying the style with the ``subscriptionStoreControlStyle(_:)-9bmew`` modifier.

Members (0)

This type has no directly callable members in this snapshot. See the framework’s skipped declarations for unsupported APIs.

Skipped declarations

9 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

SubscriptionStoreView.init(groupID:visibleRelationships:marketingContent:)

callback cannot propagate synchronous failure

SubscriptionStoreView.init(productIDs:marketingContent:)

callback cannot propagate synchronous failure

SubscriptionStoreView.init(subscriptions:marketingContent:)

callback cannot propagate synchronous failure

SubscriptionStoreView.init(productIDs:)

This parameter hides a concrete Swift type.

SubscriptionStoreView.init(subscriptions:)

This parameter hides a concrete Swift type.

SubscriptionStoreView.body

This protocol needs associated types that cannot yet cross the bridge.

SubscriptionStoreView.init(groupID:visibleRelationships:content:)

This declaration needs Swift generic type arguments. (no canonical witness for C)

SubscriptionStoreView.init(subscriptions:content:)

This declaration needs Swift generic type arguments. (no canonical witness for C)

SubscriptionStoreView.init(productIDs:content:)

This declaration needs Swift generic type arguments. (no canonical witness for C)

All _StoreKit_SwiftUI types →