Display HealthBridge data with UI Toolkit
The Health Data Review sample uses UIDocument, UXML, USS, and runtime
VisualElement views. Keep HealthBridge operations in a controller or view
model instead of individual visual elements.
Recommended flow
Section titled “Recommended flow”Screen opens ↓Show loading state ↓Initialize or reuse HealthBridge ↓Check capability and read data ↓Map SDK records to display models ↓Render content, empty, permission, unsupported, or error stateSeparate SDK and display models
Section titled “Separate SDK and display models”Pass only required presentation fields into a view:
- Localized label.
- Formatted date, duration, value, and unit.
- Optional-metric visibility flags.
- Non-sensitive category/icon information.
- Route, retry, or delete availability.
Avoid giving every VisualElement record IDs, raw callbacks, or permission
payloads.
Handle async lifetime
Section titled “Handle async lifetime”An awaited operation can finish after a screen closes. Track whether the
controller is still active before updating its UIDocument.
Subscribe to HealthBridgeEvents in OnEnable, unsubscribe in OnDisable, and
stop monitoring when the feature closes. Do not start reads from a per-frame UI
callback.
Design every state
Section titled “Design every state”- Loading
- Content
- Successful empty result
- Permission guidance
- Unsupported capability
- Recoverable error
On iOS, an empty read must not claim that permission was granted or no records exist.
Use the sample
Section titled “Use the sample”The Asset Store package includes Health Data Review under
Assets/HealthBridge/Samples/. Study its UI Toolkit controller, workout cards,
route preview, swipe-to-delete behavior, safe-area handling, and state panels.
Create project-owned styles and view models rather than coupling production UI
to sample internals.
Privacy
Section titled “Privacy”Do not expose raw IDs, routes, or health payloads in screenshots, diagnostics, support UI, or shareable views.
