CXR-L(EN)
cxr-l-sdk · v1.0.1 · snapshot 2026-05-13· ↗ source

Glasses Custom View

iOS: Glasses-side Custom View

Scenario

Describe the layout via JSON and deliver icon resources, then open, update, and close the Custom View UI on the glasses.

Prerequisites

  • Authentication and connection are completed (see “Connection and Session”).
  • Encoded icon data and layout JSON are prepared (field names must match the protocol).

Key APIs (by name)

The following names follow RGCxrClient’s public Swift APIs. If Xcode autocomplete shows slight differences, follow the headers:

  • sendCustomViewIcons(_:): upload icons (encoded as JSON / struct array).
  • openCustomView(_:): open the full tree for the first time.
  • updateCustomView(_:): incremental updates.
  • closeCustomView(): close.
  • customViewRunningEventPublisher: observe runtime state and drive phone-side UI hints.
  1. Build a list of IconData (or equivalent type) → call sendCustomViewIcons.
  2. Call openCustomView to send root and child nodes.
  3. For partial changes, call updateCustomView with only the changed node ids and props.
  4. When done, call closeCustomView.

Development suggestions

  • Keep icon name consistent between the icon list and layout JSON references.
  • Prefer incremental updates to reduce bandwidth and flicker.
  • Use customViewRunningEventPublisher to determine whether it is safe to open again.
  • After scene building is complete (the view is running on the glasses), enable Audio and Photo entries under the same session (aligned with “Connection and Session”).

Sample entry points (typical)

ActionCommon demo method name
Send iconssendCustomIcons
Open/update/closeopenCustomViewTapped / updateCustomViewTapped / closeCustomViewTapped
Data structuresCustomViewItems.swift, etc.

Please follow the actual symbol names in the ios_cxr_l_sample repo.

Marcin Miazga