Contents

SubscriptionStoreControlStyleConfiguration.Option

Properties of an auto-renewable subscription option to merchandise.

Declaration

@dynamicMemberLookup struct Option

Overview

You use SubscriptionStoreControlStyleConfiguration.Option very similarly to Product values, with some important differences:

  • The offer property indicates the offer that applies to the purchase. Display the terms of the offer, and ignore offer properties on Product.SubscriptionInfo, such as introductoryOffer.

  • If the offer is nil, no offer applies to the purchase.

  • Call the subscribe() method when a customer activates a control to subscribe to a subscription option, instead of methods on Product, such as purchase(confirmIn:options:).

  • Access the decorative icon using the icon property.

SubscriptionStoreControlStyleConfiguration.Option is a dynamic member lookup type, so you don’t need to use subscription directly to access the properties of the Product value. Instead, access the properties of Product or Product.SubscriptionInfo directly on the Option value. In the example below, the displayName property is available on Option to use as the button label:

struct DisplayNameButtonsControlStyle: SubscriptionStoreControlStyle {

    func makeBody(configuration: Configuration) -> some View {
        ForEach(configuration.options) { option in
            Button(option.displayName, action: option.subscribe)
        }
    }
}

Topics

Getting the subscription product and offer

Getting the icon

Purchasing a subscription option

Looking up dynamic members

Default Implementations

See Also

Getting subscription options to merchandise