Components

Onboarding

A welcome that sells the app, then a first question. Built in all 5 Effect UI styles, in light and dark mode.

Onboarding in Prism, light mode
Onboarding in Prism, dark mode
Prism ProLiquid Glass on living colour.
Onboarding in Ledger, light mode
Onboarding in Ledger, dark mode
Ledger FreeCalm, precise, trustworthy.
Onboarding in Bounce, light mode
Onboarding in Bounce, dark mode
Bounce ProChunky, tactile, joyful.
Onboarding in Folio, light mode
Onboarding in Folio, dark mode
Folio ProEditorial and literary.
Onboarding in Bloom, light mode
Onboarding in Bloom, dark mode
Bloom ProSoft, organic, calming.

Source: Ledger

OnboardingView.swift in the free Ledger style. It needs Ledger's Theme.swift, which comes with the style: join early access on the home page and it's emailed to you.

import SwiftUI

private struct Institution: Identifiable, Hashable {
    let id = UUID()
    let name: String
    let monogram: String
    let products: String
}

private let institutions: [Institution] = [
    Institution(name: "Chase", monogram: "CH", products: "Checking, savings, cards"),
    Institution(name: "Bank of America", monogram: "BA", products: "Checking, savings, cards"),
    Institution(name: "Wells Fargo", monogram: "WF", products: "Checking, savings, loans"),
    Institution(name: "Capital One", monogram: "CO", products: "Cards, savings, auto loans"),
    Institution(name: "Ally Bank", monogram: "AL", products: "Online savings, checking"),
    Institution(name: "Charles Schwab", monogram: "CS", products: "Brokerage, checking"),
    Institution(name: "American Express", monogram: "AX", products: "Cards, high-yield savings"),
    Institution(name: "Fidelity", monogram: "FI", products: "Brokerage, retirement"),
]

struct OnboardingView: View {
    @State private var step = 0

    var body: some View {
        ZStack {
            if step == 0 {
                ValueStep { advance(to: 1) }
                    .transition(.asymmetric(
                        insertion: .opacity,
                        removal: .opacity.animation(Theme.Motion.surfaceExit)
                    ))
            } else {
                ConnectStep { advance(to: 0) }
                    .transition(.asymmetric(
                        insertion: .move(edge: .trailing).combined(with: .opacity),
                        removal: .opacity.animation(Theme.Motion.surfaceExit)
                    ))
            }
        }
        .paperBackground()
    }

    private func advance(to newStep: Int) {
        withAnimation(Theme.Motion.surfaceEnter) { step = newStep }
    }
}

// MARK: - Step 1: value proposition

private struct ValueStep: View {
    let onContinue: () -> Void

    var body: some View {
        ScrollView {
            VStack(spacing: Theme.Space.xxl) {
                HStack {
                    Text("tilde")
                        .ledgerType(.headlineMd)
                        .foregroundStyle(Theme.onSurface)
                    Spacer()
                    MicroLabel("Step 1 of 2")
                }

                specimen

                VStack(spacing: Theme.Space.md) {
                    Text("Money, set in\nclear type.")
                        .ledgerType(.headlineLg)
                        .foregroundStyle(Theme.onSurface)
                        .multilineTextAlignment(.center)
                    Text("Tilde gathers every account into one calm, exact ledger, so you always know where you stand.")
                        .ledgerType(.bodyMd)
                        .foregroundStyle(Theme.onSurfaceVariant)
                        .multilineTextAlignment(.center)
                        .fixedSize(horizontal: false, vertical: true)
                }
                .frame(maxWidth: .infinity)

                VStack(alignment: .leading, spacing: 0) {
                    Hairline(strong: true)
                    RuledStack {
                        point("square.stack.3d.up.fill", "Every account in one place", "Checking, savings, cards and loans")
                        point("chart.bar.fill", "Budgets that keep pace", "What is left in each category, to the cent")
                        point("lock.fill", "Private by design", "Read-only access. Your data is never sold.")
                    }
                }
            }
            .padding(.horizontal, Theme.Space.margin)
            .padding(.top, Theme.Space.sm)
            .padding(.bottom, Theme.Space.xl)
        }
        .scrollIndicators(.hidden)
        .safeAreaInset(edge: .bottom) {
            BottomActionBar {
                Button("Connect your bank", action: onContinue)
                    .buttonStyle(.ledgerPrimary)
                Button("Set up later") {}
                    .buttonStyle(TextButtonStyle(color: Theme.onSurfaceVariant))
            }
        }
    }

    /// A typographic specimen of the product: the balance hero and its trend line.
    private var specimen: some View {
        VStack(alignment: .leading, spacing: Theme.Space.lg) {
            BalanceHero(
                label: "Across 5 accounts",
                amount: 24318.62,
                delta: 1204.18,
                percent: 5.2,
                period: "this month",
                showsRule: false
            )
            LedgerLineChart(
                values: [18.2, 18.9, 18.6, 19.8, 20.4, 20.1, 21.6, 22.3, 22.0, 23.1, 23.7, 24.3],
                labels: ["Dec", "Mar", "Jun", "Sep", "Nov"],
                height: 72,
                zeroBaseline: false
            )
        }
        .ledgerCard()
    }

    private func point(_ symbol: String, _ title: String, _ detail: String) -> some View {
        LedgerRow(title: title, subtitle: detail) {
            SymbolTile(symbol: symbol)
        } trailing: {
            EmptyView()
        }
    }
}

// MARK: - Step 2: connect your bank

private struct ConnectStep: View {
    let onBack: () -> Void

    @State private var query = ""
    @State private var selection: Institution?
    @FocusState private var searching: Bool

    private var results: [Institution] {
        let q = query.trimmingCharacters(in: .whitespaces)
        guard !q.isEmpty else { return institutions }
        return institutions.filter { $0.name.localizedCaseInsensitiveContains(q) }
    }

    var body: some View {
        ScrollView {
            VStack(alignment: .leading, spacing: Theme.Space.xl) {
                HStack {
                    IconButton(symbol: "chevron.left", action: onBack)
                    Spacer()
                    MicroLabel("Step 2 of 2")
                }

                ScreenHeader(eyebrow: "Connect", title: "Connect your bank")

                Text("Tilde reads balances and transactions. It can never move money or make payments.")
                    .ledgerType(.bodyMd)
                    .foregroundStyle(Theme.onSurfaceVariant)
                    .fixedSize(horizontal: false, vertical: true)

                searchField

                VStack(alignment: .leading, spacing: 0) {
                    SectionHeader(title: query.isEmpty ? "Popular" : "Results", detail: "\(results.count)")
                    if results.isEmpty {
                        Text("No match for \u{201C}\(query)\u{201D}. Try the name on your statement.")
                            .ledgerType(.bodySm)
                            .foregroundStyle(Theme.onSurfaceMuted)
                            .frame(minHeight: Theme.Space.rowHeight)
                    } else {
                        RuledStack(closed: true) {
                            ForEach(results) { inst in
                                institutionRow(inst)
                            }
                        }
                    }
                }

                assurances
            }
            .padding(.horizontal, Theme.Space.margin)
            .padding(.top, Theme.Space.sm)
            .padding(.bottom, Theme.Space.xl)
        }
        .scrollIndicators(.hidden)
        .scrollDismissesKeyboard(.interactively)
        .safeAreaInset(edge: .bottom) {
            BottomActionBar {
                Button(selection.map { "Continue with \($0.name)" } ?? "Choose your bank") {}
                    .buttonStyle(.ledgerPrimary)
                    .disabled(selection == nil)
                    .animation(Theme.Motion.stateChange, value: selection)
                Button("Add an account manually") {}
                    .buttonStyle(TextButtonStyle(color: Theme.onSurfaceVariant))
            }
        }
        .sensoryFeedback(.selection, trigger: selection)
    }

    private var searchField: some View {
        HStack(spacing: Theme.Space.sm) {
            Image(systemName: "magnifyingglass")
                .font(.system(size: 15, weight: .semibold))
                .foregroundStyle(Theme.onSurfaceMuted)
            TextField("Search 11,000 institutions", text: $query)
                .ledgerType(.bodyMd)
                .foregroundStyle(Theme.onSurface)
                .focused($searching)
                .textInputAutocapitalization(.words)
                .autocorrectionDisabled()
            if !query.isEmpty {
                Button {
                    query = ""
                } label: {
                    Image(systemName: "xmark.circle.fill")
                        .foregroundStyle(Theme.onSurfaceMuted)
                }
                .buttonStyle(.plain)
            }
        }
        .padding(.horizontal, Theme.Space.md)
        .frame(height: 44)
        .background(RoundedRectangle(cornerRadius: Theme.Radius.md, style: .continuous).fill(Theme.surfaceRaised))
        .overlay(
            RoundedRectangle(cornerRadius: Theme.Radius.md, style: .continuous)
                .strokeBorder(searching ? Theme.ruleStrong : Theme.rule, lineWidth: searching ? 1 : 0.5)
        )
        .animation(Theme.Motion.stateChange, value: searching)
    }

    private func institutionRow(_ inst: Institution) -> some View {
        let selected = selection == inst
        return Button {
            withAnimation(Theme.Motion.stateChange) {
                selection = selected ? nil : inst
            }
        } label: {
            LedgerRow(title: inst.name, subtitle: inst.products) {
                MonogramTile(letters: inst.monogram)
            } trailing: {
                ZStack {
                    Circle()
                        .strokeBorder(selected ? Theme.primaryInk : Theme.rule, lineWidth: 1.5)
                    if selected {
                        Image(systemName: "checkmark")
                            .font(.system(size: 10, weight: .semibold))
                            .foregroundStyle(Theme.primaryInk)
                    }
                }
                .frame(width: 20, height: 20)
            }
        }
        .buttonStyle(.plain)
        .accessibilityAddTraits(selected ? .isSelected : [])
    }

    private var assurances: some View {
        VStack(alignment: .leading, spacing: 0) {
            SectionHeader(title: "How your data is handled")
            RuledStack {
                assurance("eye", "Read-only", "Tilde sees activity. It cannot move funds.")
                assurance("lock", "Encrypted end to end", "256-bit TLS in transit, AES-256 at rest")
                assurance("link", "Yours to revoke", "Disconnect any bank from Profile, anytime")
            }
        }
    }

    private func assurance(_ symbol: String, _ title: String, _ detail: String) -> some View {
        LedgerRow(title: title, subtitle: detail) {
            Image(systemName: symbol)
                .font(.system(size: 15, weight: .semibold))
                .foregroundStyle(Theme.onSurfaceVariant)
                .frame(width: 32)
        } trailing: {
            EmptyView()
        }
    }
}

#Preview("Light") {
    OnboardingView()
}

#Preview("Dark") {
    OnboardingView().preferredColorScheme(.dark)
}

More screens