# Visual builder & paywalls

Create supported screens, edit their saved layout, and deliver immutable releases while retaining a native fallback.

## Create and edit a flow

1. Choose an application, then open Flows → Onboarding or Paywalls.
2. Use the section's creation action to start a new design.
3. Add independent screens from templates. Adjust stacks, copy, spacing, fill and typography in the inspector.
4. Use the layer tree to select or reorder supported elements. The phone preview preserves the saved authoring geometry.
5. Save your draft before publishing. Published releases are immutable.

## Render supported screens on iOS

Fetch a compatible configuration, then pass it to AplynaFlowView from your SwiftUI host. Forward its callbacks to your SDK client. This example shows callback wiring; load configuration and provide your own navigation/error state outside this view.

### SwiftUI · configuration supplied by your host

```
import SwiftUI
import Aplyna

struct OnboardingContent: View {
    let configuration: AplynaConfiguration
    let client: AplynaClient

    var body: some View {
        AplynaFlowView(
            configuration: configuration,
            onViewed: { stepID in
                Task {
                    try await client.track(name: "onboarding_step_viewed",
                        flowID: configuration.flowID, stepID: stepID)
                    try await client.flush()
                }
            },
            onComplete: {
                Task {
                    try await client.track(name: "onboarding_completed",
                        flowID: configuration.flowID)
                    try await client.flush()
                }
            }
        )
    }
}
```

> **Experiment attribution**
> For an experiment, retain its assignment and pass it to tracked callbacks. Expose the assignment when the rendered flow becomes visible. The simplified renderer example above has no experiment attribution.

## Edit with JSON

The editor's JSON action supports Current screen and Entire flow. Copy JSON or Copy AI prompt to inspect the schema, validate and format edits, then apply them to the draft through the normal undo/save pipeline. Invalid or oversized payloads are rejected. Read only collaborators may inspect and copy; applying changes requires write access.

## Reuse paywall designs

Onboarding and Paywalls have separate libraries and creation actions. A saved paywall can be linked into onboarding or duplicated independently. Linked content changes only by explicit update; a published snapshot does not mutate when its source design changes.

> **A design is not a purchase engine**
> Paywall previews do not process purchases. Product selection, StoreKit or Play Billing, verified transactions and entitlement handling require their own supported integration and validation.

## Publish and roll back

Publish only after checking your SDK's schema support and native fallback. Swift supports schemas 1 and 2; the current Kotlin client requests schema 1. New authored layout nodes may require schema 2. Restore a prior release through Versions when you need to roll back; a draft save alone does not alter the live release.

- [Remote configuration](https://aplyna.com/docs/configuration): Version compatibility, ETags and offline behavior.
