HWAdaptive

Render different widgets on iOS and Android.

HWAdaptive

HWAdaptive is a generator-time switch: it picks the ios subtree when emitting SwiftUI and the android subtree when emitting Glance. Use it whenever the two platforms need a meaningfully different layout.

HWAdaptive(
  ios: HWText.fixed('Hello iOS'),
  android: HWText.fixed('Hello Android'),
)

Constructor

HWAdaptive({required HWWidget ios, required HWWidget android}) — both branches are required and may be any HWWidget. Each branch contributes its own data dependencies and imports.

Parameters

NameTypeDefaultDescription
iosHWWidgetrequiredWidget tree used to generate the SwiftUI body.
androidHWWidgetrequiredWidget tree used to generate the Glance content.

Platform mapping