Skip to content

iOS: track update time in MetricsPlugin #932

Description

@cehan-Chloe

Platform disparity issue: update-time tracking works on Core, React, and Android — iOS is the only platform where it cannot be implemented today.

Core, React, and Android MetricsPlugin all support trackUpdateTime — timing updates to an already-rendered view. iOS only supports trackRenderTime (first paint). This is not an unimplemented feature — it's a fundamental SwiftUI API gap with no known workaround.

Investigation ruled out three approaches:

  • .onAppear — view identity is intentionally kept stable across in-place updates (SwiftUIPlayer.swift), so it only fires once per view, never again on update.

  • Forcing view identity to change to retrigger .onAppear — would work mechanically, but causes unacceptable UI side effects (unwanted transitions/animation churn).

  • A custom onRender-style view modifier firing inline during body evaluation — fires before SwiftUI diffs, lays out, or paints anything, so it measures "time until body re-ran," not "time until the screen updated." Can also fire for reasons unrelated to the update being tracked. Concluded to basically always record a false time, not just an imprecise one.

  • .onChange — same category of limitation, no access to real paint completion.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestiOSiOS Player Related Work

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions