Skip to main content
Explore the iOS Checkout SwiftUI architecture interactively. The redesigned SDK is a SwiftUI slot API: a PrimerCheckoutSession owner wired into your view hierarchy with the .primerCheckoutSession(_:onCompletion:) modifier, plus composable views (PrimerCardForm, PrimerPaymentMethods, PrimerVaultedPaymentMethods) whose @ViewBuilder slots default to the *Defaults building blocks. Click any view, slot, or field to see its parameters, lifecycle phases, and copyable Swift code examples.

Two ways to integrate

PrimerCheckoutSession is the iOS analog of Android’s PrimerCheckoutHost. Where Android wraps your layout in a composable host, iOS injects the session into the SwiftUI environment with a view modifier — child views read their per-feature session (PrimerCardFormSession, PrimerSelectionSession) from EnvironmentValues.

Slots and defaults

Every composable view exposes @ViewBuilder slots that default to a matching *Defaults namespace builder. Override one slot and the rest keep their default rendering — you never re-implement an entire view. CardFormDefaults also exposes per-field building blocks for recomposing the card section one field at a time: cardNumber, expiryDate, cvv, cardholderName, cardNetwork, plus the billing fields firstName, lastName, email, phoneNumber, addressLine1, addressLine2, city, state, postalCode, countryCode. Each block is self-hiding — it renders nothing unless its field is part of the active CardFormConfiguration. Field presence is Dashboard-driven; visual styling comes from the PrimerCheckoutTheme design tokens.

Sessions and state

Composable views are driven by observable sessions injected into the environment by .primerCheckoutSession(_:onCompletion:). Observe them with @ObservedObject and read their published state. The terminal outcome of the flow is delivered exactly once through the modifier’s onCompletion closure as a PrimerCheckoutState:

PrimerCardFormState


Composing custom UI

Hold the session as a @StateObject, place the composable views in your layout, and attach the modifier. The child views resolve their per-feature session from the environment — you do not pass a session into them.
Without the .primerCheckoutSession(_:onCompletion:) modifier above them in the hierarchy, composable views such as PrimerCardForm and PrimerPaymentMethods cannot resolve a session and will not function.