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
| Name | Type | Default | Description |
|---|---|---|---|
ios | HWWidget | required | Widget tree used to generate the SwiftUI body. |
android | HWWidget | required | Widget tree used to generate the Glance content. |
Platform mapping
- iOS: delegates to the
ioschild — see SwiftUIView. - Android: delegates to the
androidchild — see Glance composables.