SubscriptionStoreControlStyleConfiguration.Option
Properties of an auto-renewable subscription option to merchandise.
Declaration
@dynamicMemberLookup struct OptionOverview
You use SubscriptionStoreControlStyleConfiguration.Option very similarly to Product values, with some important differences:
The
offerproperty indicates the offer that applies to the purchase. Display the terms of theoffer, and ignore offer properties on Product.SubscriptionInfo, such as introductoryOffer.If the
offerisnil, 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)
}
}
}