ENUM
HaapiPreviewConnector
Contents
- Methods
makeThemeHandle(theme:bundle:)specializedRepresentation(from:)bindFlowResolver(on:themeHandle:)installPreviewSafeWebAuthnEngine(on:)makeFlowContainer(wrapping:themeHandle:)makeActionableButton(themeHandle:variant:title:)makeMessageView(themeHandle:variant:text:)makeUserCodeMessageView(themeHandle:codes:)makeInputTextField(themeHandle:variant:label:placeholder:errorText:)makeCheckboxView(themeHandle:title:isChecked:)makeHeaderView(themeHandle:)makeLinkView(themeHandle:text:)makeNotificationBanner(themeHandle:variant:title:actionTitle:)makeExpandableView(themeHandle:title:content:)makeLoadingIndicator(themeHandle:)
@_spi(HaapiPreview) public enum HaapiPreviewConnector
The SPI seam between the shipped framework binary and the source-distributed previewer.
Every entry point is strictly necessary for the previewer to function; the allowed surface is
enumerated in the seam contract and enforced by the release seam guard. Internal component and
style types never cross the seam — component factories take the theme handle plus a variant
enum, resolve the internal style inside the binary, and return the component type-erased as
UIView. Compiled unconditionally (the previewer sources link against the release binary) and
inert unless called.
Methods
makeThemeHandle(theme:bundle:)
public static func makeThemeHandle(theme: String, bundle: Bundle) throws -> HaapiPreviewThemeHandle
Loads the named theme from the given bundle and returns a type-erased handle to it.
- Throws: when the bundle does not contain
<theme>.plist, or theme loading fails.
specializedRepresentation(from:)
public static func specializedRepresentation(
from step: GenericRepresentationStep
) throws -> any HaapiRepresentation
Converts a decoded generic representation step into its specialized representation — the internal decode step the SDK performs during flows. Both parameter and return types are public.
bindFlowResolver(on:themeHandle:)
public static func bindFlowResolver(
on viewController: GenericViewController,
themeHandle: HaapiPreviewThemeHandle
)
Binds the standard flow view-controller resolver so a GenericViewController can
resolve its child form/selector view controllers.
installPreviewSafeWebAuthnEngine(on:)
public static func installPreviewSafeWebAuthnEngine(on viewController: WebAuthnViewController)
Replaces the view controller's WebAuthn engine with a preview-safe decorator that blocks
credential ceremonies (ASAuthorizationController is unsupported in preview contexts).
makeFlowContainer(wrapping:themeHandle:)
public static func makeFlowContainer(
wrapping childViewController: UIViewController,
themeHandle: HaapiPreviewThemeHandle
) throws -> UIViewController
Wraps a view controller in a lightweight container replicating the HaapiFlowViewController
visual layout (scroll view, padding, themed header, background color).
- Throws: when the theme lacks the flow view controller style.
makeActionableButton(themeHandle:variant:title:)
public static func makeActionableButton(
themeHandle: HaapiPreviewThemeHandle,
variant: ButtonVariant,
title: String
) -> UIView
Returns a styled button with the given title.
makeMessageView(themeHandle:variant:text:)
public static func makeMessageView(
themeHandle: HaapiPreviewThemeHandle,
variant: MessageVariant,
text: String
) -> UIView
Returns a styled message view with the given text.
makeUserCodeMessageView(themeHandle:codes:)
public static func makeUserCodeMessageView(
themeHandle: HaapiPreviewThemeHandle,
codes: [String]
) -> UIView
Returns a styled user-code message view. The copy-button title is a localized string resolved from the theme.
makeInputTextField(themeHandle:variant:label:placeholder:errorText:)
public static func makeInputTextField(
themeHandle: HaapiPreviewThemeHandle,
variant: InputTextFieldVariant,
label: String,
placeholder: String,
errorText: String?
) throws -> UIView
Returns a styled input text field for the given implementation variant.
- Throws: when the theme lacks the named style
"InputTextField.<variant>".
makeCheckboxView(themeHandle:title:isChecked:)
public static func makeCheckboxView(
themeHandle: HaapiPreviewThemeHandle,
title: String,
isChecked: Bool
) -> UIView
Returns a styled checkbox in the given state.
makeHeaderView(themeHandle:)
public static func makeHeaderView(themeHandle: HaapiPreviewThemeHandle) -> UIView
Returns a styled header view. Also used by the previewer's flow container.
makeLinkView(themeHandle:text:)
public static func makeLinkView(themeHandle: HaapiPreviewThemeHandle, text: String) -> UIView
Returns a styled link view with the given text.
makeNotificationBanner(themeHandle:variant:title:actionTitle:)
public static func makeNotificationBanner(
themeHandle: HaapiPreviewThemeHandle,
variant: BannerVariant,
title: String,
actionTitle: String?
) throws -> UIView
Returns a styled notification banner, immediately visible (the banner normally animates
in from alpha = 0; previews render it statically). Pass actionTitle: nil for no action button.
- Throws: for
.success, when the theme lacks the named style"NotificationBannerView.Success".
makeExpandableView(themeHandle:title:content:)
public static func makeExpandableView(
themeHandle: HaapiPreviewThemeHandle,
title: String,
content: String
) throws -> UIView
Returns a styled expandable view in its collapsed state; it expands on tap.
- Throws: when the theme lacks the named style
"ExpandableView".
makeLoadingIndicator(themeHandle:)
public static func makeLoadingIndicator(themeHandle: HaapiPreviewThemeHandle) -> UIView
Returns a styled loading indicator. Its intrinsic content size is zero before layout — callers must add explicit size constraints.