Contents

updateProductVisibility(_:for:)

Updates a value that indicates whether a promoted in-app purchase appears in the App Store on the user’s device.

Declaration

static func updateProductVisibility(_ visibility: Product.PromotionInfo.Visibility, for productID: Product.ID) async throws

Parameters

  • visibility:

    A visibility value of Visibility Swift.enum that determines whether a promoted in-app purchase appears in the App Store on the user’s device.

  • productID:

    The product identifier of the promoted in-app purchase.

Mentioned in

Discussion

Call this method to change the visibility setting for a promoted in-app purchase. Changes take effect after you call this method.

The following code example updates a promoted product’s visibility after the user purchases it. The purchased product is hidden to avoid showing it again on the device.

// Update visibility to hide a promoted product after the user purchases it.
let purchasedProductIdentifier = "com.example.ExampleApp.product1"

do {
  try await Product.PromotionInfo.updateProductVisibility(.hidden, for: purchasedProductIdentifier)
}
catch {
  <#Handle Error#>
}

See Also

Managing promotion visibility