Skip to main content
Primer Checkout iOS SDK is currently in beta (v3.0.0-beta.8). The API is subject to change before the stable release.
SpacingOverrides lets you override the spacing scale the Primer iOS SDK uses for padding, gaps, and layout rhythm across the prebuilt screens and the composable views. You pass it through the spacing parameter of PrimerCheckoutTheme. Every property is optional. A nil value falls back to the internal default token, so you only set the values you want to change.
Internal DesignTokens (auto-generated from JSON) remain the source of truth for spacing. SpacingOverrides merges your values on top of those defaults — any token you leave nil keeps its internal default.

Properties

All properties are CGFloat? and measured in points. The default column shows the internal token value used when you leave the property nil.
Input field height is max(44, 2 × primerSpaceMedium + bodyLarge line height). With the default 20pt body line height, primerSpaceMedium: 16 gives 52pt fields. Fields grow with Dynamic Type.

Initializer

Every parameter defaults to nil, so you can construct an override that touches only the tokens you care about.

Overriding spacing

Build a PrimerCheckoutTheme with a SpacingOverrides value and pass it to your checkout. The example below loosens the spacing between fields, payment method rows, and sections. Because primerSpaceMedium also sets the field padding, input fields are 52pt tall.
Apply the theme on the prebuilt modal by passing it to primerTheme:
When you embed the composable views inline, pass the theme to the PrimerCheckoutSession instead. The composable views resolve the merged tokens from the session.
Spacing tokens form a scale. Overriding primerSpaceSmall, primerSpaceMedium, and primerSpaceLarge together keeps the rhythm consistent; changing a single step in isolation can make the layout feel uneven.
These tokens control the spacing used inside Primer’s own views. They do not affect the padding you add around the SDK in your own layout — use standard SwiftUI modifiers such as .padding() for that.

See also

PrimerTheme

The theme container that carries spacing and the other override groups.

Shape Tokens

Corner-radius and border-width override tokens.