StoreKit ProductView, StoreView, and SubscriptionStoreView under One.iOS
StoreKit’s merchandising views under One.iOS: ProductView for one
product, StoreView for a list, and SubscriptionStoreView for a
subscription group. StoreKit loads each product from the App Store, draws its
name, price, and buy button, and runs the purchase sheet when the person taps
it.
Product identifiers come from App Store Connect, or from a StoreKit configuration file while you develop. A product that does not load shows StoreKit’s own unavailable state. To list products, buy them, and read entitlements from code, use Purchases. These views throw on web and Android.
import { One } from 'one'
function Store() { return ( <> <One.iOS.ProductView id="com.example.coins.100" /> <One.iOS.SubscriptionStoreView groupID="21482456" style={{ height: 420 }} /> </> )}The binding uses ProductView(id:prefersPromotionalIcon:),
StoreView(ids:prefersPromotionalIcon:), and the SubscriptionStoreView
groupID:visibleRelationships: or productIDs: initializers. Overloads
accepting StoreKit.Product objects, icon builders, or marketing content are
not bound: their arguments include native product values and callbacks
returning generic SwiftUI views, which the generated constructor bridge
cannot carry. Pass catalog identifiers to the bound overloads.
One product with its icon, name, description, and buy button.
import { One } from 'one'
function Coins() { return <One.iOS.ProductView id="com.example.coins.100" prefersPromotionalIcon />}| Props | Type | Description |
|---|---|---|
id (required)stringThe product identifier. | string | The product identifier. |
prefersPromotionalIconboolean = falseUses the promotional image from App Store Connect as the icon. | boolean = false | Uses the promotional image from App Store Connect as the icon. |
A list of products, each drawn as a ProductView.
import { One } from 'one'
function CoinStore() { return <One.iOS.StoreView ids={['com.example.coins.100', 'com.example.coins.500']} />}| Props | Type | Description |
|---|---|---|
ids (required)readonly string[]The product identifiers, in display order. | readonly string[] | The product identifiers, in display order. |
prefersPromotionalIconboolean = falseUses each promotional image as its icon. | boolean = false | Uses each promotional image as its icon. |
The subscription store for one group of auto-renewable subscriptions. Pass
exactly one of groupID and productIDs; both or neither throws.
visibleRelationships applies only with groupID and throws with
productIDs. Give it a height, since it fills the box React Native gives it.
import { One } from 'one'
function Subscribe() { return ( <One.iOS.SubscriptionStoreView groupID="21482456" visibleRelationships="all" style={{ height: 420 }} /> )}| Props | Type | Description |
|---|---|---|
groupIDstringThe subscription group identifier. | string | The subscription group identifier. |
visibleRelationships"current" | "downgrade" | "crossgrade" | "upgrade" | "all" = "all"Which plans to show relative to the current one. Only with groupID; it throws with productIDs. | "current" | "downgrade" | "crossgrade" | "upgrade" | "all" = "all" | Which plans to show relative to the current one. Only with groupID; it throws with productIDs. |
productIDsreadonly string[]The subscription product identifiers to show. | readonly string[] | The subscription product identifiers to show. |
| iOS | Android | Web | |
|---|---|---|---|
| Renders | StoreKit views | Throws | Throws |
| Catalog | App Store | None | None |
| Purchase | System sheet | None | None |
groupID and productIDs,
and visibleRelationships only with groupID.Edit this page on GitHub.