subscription
The auto-renewable subscription to merchandise.
Declaration
var subscription: Product { get }Discussion
SubscriptionStoreControlStyleConfiguration.Option is a dynamic member lookup type, which code refers to as Option when it’s a nested type. You don’t need to use the subscription property directly to access the properties of the Product value. Instead, access any properties of Product or Product.SubscriptionInfo directly on the Option value.
The following code example creates a button for each subscription option and displays its name. The displayName property is available on SubscriptionStoreControlStyleConfiguration.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)
}
}
}