Skip to content

Phase 2: Navigation, Gestures, Animations, Input Preservation #2

@codelynx

Description

@codelynx

Phase 2 — Cross-Platform Features

These are core library features (Sources/SwiftOpenUI/) with backend rendering on all platforms. Design in core first, then implement per-backend.

1. Navigation

  • NavigationStack view, NavigationLink view, NavigationPath
  • Each backend manages a back stack (Compose navigation, GTK stack, Win32 pages, browser history, etc.)

2. Gestures

  • .onTapGesture {}, .onLongPressGesture {}
  • DragGesture with .onChanged / .onEnded
  • Core modifier views + per-backend event wiring

3. Animations

  • withAnimation { } block
  • .animation(.easeInOut, value:) modifier
  • Initial scope: opacity and offset transitions
  • Compose has built-in animation APIs; other backends need platform-specific interpolation

4. Input-State Preservation

  • Cursor position, selection range, IME composition, focus survival across rebuilds
  • Currently all backends use full-rebuild model — cursor/focus is lost on state change
  • Options: save/restore snapshots (like Win32's FocusSnapshot), or cross-platform diff engine
  • Trigger: TextField UX on any platform

Platforms

Work happens across all 5 platforms: macOS, Linux (GTK4), Windows (Win32), Web (Wasm), Android (Compose).

Branch

Work on develop. Create experimental/phase2-* branches for individual features if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions