Simulator

Preview DynamicLake extension UI in a regular macOS app.

Overview

Use simulator views in demo apps and development tools before installing a signed extension. They provide SwiftUI preview surfaces for compact live activity and sneak peek UI.

The simulator is not shown automatically when an app imports DynamicLakeKit. Add a normal macOS debug or demo view, pass your provider and sample states into the simulator, and expose any controls your extension needs for testing.

Create a Provider

A provider supplies the activity configuration, state type, compact view, and optional sneak peek view.

import DynamicLakeKit
import SwiftUI

struct ClockLiveActivityProvider: DynamicLakeLiveActivityViewProvider {
    typealias State = DynamicLakeEmptyLiveActivityState

    let configuration = DynamicLakeLiveActivityConfiguration(
        id: "clock",
        priority: .normal,
        size: .large,
        supportsSneakPeek: true
    )

    func compactView(context: DynamicLakeLiveActivityContext<State>) -> some View {
        ClockLiveActivityView(geometry: context.geometry)
    }

    func sneakPeekView(context: DynamicLakeSneakPeekContext<State>) -> some View {
        ClockSneakPeekView(geometry: context.geometry)
    }
}

Show Compact and Sneak Peek

Use DynamicLakeLiveActivitySimulator to view both surfaces together.

DynamicLakeLiveActivitySimulator(
    provider: ClockLiveActivityProvider(),
    mode: .both,
    panelShape: .notch
)

Switch DynamicLakeLiveActivitySimulatorShape between .notch and .pill to test both panel shapes.

Pill mode is not only a different clip shape. The simulator applies the same reduced compact panel, widened sneak-peek panel, pill radius, and content scale used by DynamicLake Pro on external displays. Keep compact and sneak-peek layouts based on context.geometry so the same provider works in both shapes.

Show One Surface

Use the focused simulators when you only need one surface.

DynamicLakeLiveActivityCompactSimulator(
    provider: ClockLiveActivityProvider(),
    panelShape: .notch
)
DynamicLakeLiveActivitySneakPeekSimulator(
    provider: ClockLiveActivityProvider(),
    panelShape: .pill
)

Test With State

If a provider uses custom state, pass the state into the simulator.

DynamicLakeLiveActivitySimulator(
    provider: ClockLiveActivityProvider(),
    state: ClockActivityState(timeText: "12:45"),
    mode: .both,
    panelShape: .notch
)

Topics

Simulator Views

Provider APIs