Skip to content

Scaffold ios-swift: native SwiftUI client for traverse-starter #44

Description

@enricopiovesan

Summary

Create apps/traverse-starter/ios-swift/ — a native iOS client for the traverse-starter reference app using SwiftUI and URLSession. Phase 1 uses the same HTTP polling approach as web-react (POST execute → GET poll → render result). SSE subscription is the phase 2 upgrade path once Traverse ships the state machine.

Phase 1 scope (HTTP polling — unblocked)

  • Native iOS app that calls the Traverse HTTP/JSON API
  • Text input → POST /v1/workspaces/{workspace}/execute → poll until complete → display output
  • Runtime URL + workspace configurable via Settings screen
  • Health check (GET /health) shown as status indicator
  • Mirrors web-react behaviour exactly — same API calls, same output fields

Stack

Concern Choice
Language Swift 6
UI framework SwiftUI
HTTP URLSession (no third-party dependencies)
Min target iOS 17
Architecture MVVM — ExecutionViewModel owns idle→loading→polling→done state

Directory structure

apps/traverse-starter/ios-swift/
  TraverseStarter.xcodeproj/
  TraverseStarter/
    TraverseClient.swift          # URLSession HTTP client (execute + poll)
    ExecutionViewModel.swift      # ObservableObject — idle/loading/polling/done
    ContentView.swift             # Main SwiftUI view
    SettingsView.swift            # Runtime URL + workspace config
    Assets.xcassets/
    Info.plist
  TraverseStarterTests/
    TraverseClientTests.swift
    ExecutionViewModelTests.swift

UI screens

Settings (first launch)

  • Text field: Runtime URL (e.g. http://192.168.1.42:8787)
  • Text field: Workspace (default: local-default)
  • Save button

Main screen

  • Runtime status indicator (Online / Offline)
  • TextEditor for note input
  • Submit button — disabled when offline or state ≠ idle
  • Output section — title, tags, noteType, suggestedNextAction, status
  • Trace section — expandable list of trace events
  • Reset button

Phase 2 upgrade path (do not implement now)

When Traverse ships #525 (state machine), #526 (SSE), and #527 (command dispatch):

  • Replace ExecutionViewModel polling loop with URLSessionDataDelegate SSE subscription
  • Replace execute() call with sendCommand("submit", { note })
  • AppStateViewModel receives state_changed events — zero local transition logic
  • QR code URL provisioning (Traverse #523)
  • dev-any auth for real device on WiFi (Traverse #524)

Definition of Done

  • Xcode project builds for iOS 17+ simulator with zero warnings
  • Settings screen: manual URL input, persisted to UserDefaults
  • Health check status shown on main screen
  • Note input → execute → poll → renders output fields
  • Reset clears output and returns to idle
  • Unit tests for TraverseClient and ExecutionViewModel
  • README in ios-swift/ covering: prerequisites, runtime URL config, build and run on simulator
  • scripts/ci/repository_checks.sh updated to acknowledge ios-swift/ directory

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions