Contents

preferredSubscriptionPricingTerms(_:)

Sets the pricing terms that the store uses to merchandise the subscription options within this store content.

Declaration

nonisolated func preferredSubscriptionPricingTerms(_ pricingTerms: @escaping (Product, SubscriptionInfo) -> SubscriptionInfo.PricingTerms?) -> some StoreContent

Parameters

  • pricingTerms:

    A closure that the system calls before it draws each subscription product. The closure receives the product and its subscription information. Return the pricing terms to use for that subscription option, or nil to use the subscription’s default pricing terms.

Mentioned in

Discussion

Use this modifier on a SubscriptionOptionGroup or other store content to choose the pricing terms for the subscription options within that content. Different groups in one subscription store view can then show the same products with different pricing terms, for example, a group that shows seat-based pricing terms for multiseat purchases.

Unlike the preferredSubscriptionPricingTerms(_:) view modifier, which applies to every subscription store in the view, this modifier applies only to the store content you apply it to. The pricing terms you set override pricing terms that you set in ancestor views. If the pricing terms you return don’t exist for a subscription, the store uses the subscription’s default pricing terms.

To read the pricing terms in a custom control style, use preferredPricingTerms.

See Also

Choosing pricing terms