ShelfWidgetLayoutTraits
Declarative layout parameters for one shelf widget.
struct ShelfWidgetLayoutTraits
These replace the per-widget width tables Droppy used to hardcode. The shelf owns the single layout algorithm; the widget only supplies numbers. The width fields remain optional solely for source and binary compatibility, but current Droppy hosts admit a descriptor only when both are explicit. nil never selects a host geometry fallback; the descriptor is refused.
Initializers
init(preferredSoloWidth:preferredPairedWidth:pairWeight:minimumWidth:contentHeight:)
init(preferredSoloWidth: CGFloat? = nil, preferredPairedWidth: CGFloat? = nil, pairWeight: Double = 1, minimumWidth: CGFloat? = nil, contentHeight: ShelfWidgetContentHeight = .standard)
Creates layout traits.
The optional width defaults preserve existing source and binary call sites, but they do not create a host-layout fallback. A current Droppy host refuses a widget descriptor unless both preferredSoloWidth and preferredPairedWidth are explicit. minimumWidth and contentHeight retain their ordinary host defaults.
Properties
contentHeight
let contentHeight: ShelfWidgetContentHeight
Content height request.
minimumWidth
let minimumWidth: CGFloat?
Hard minimum width in points. The shelf never lays the widget out narrower than this. nil uses the shelf's floor.
pairWeight
let pairWeight: Double
Relative weight when the shelf splits space across a grouped row. 1 is an even share. The compatibility name "pair" applies to every row containing two to four widgets.
preferredPairedWidth
let preferredPairedWidth: CGFloat?
Preferred width in points when the widget shares a row with one to three other widgets. The compatibility name "paired" means every grouped row (2...4), not only exactly two widgets.
This remains optional for source and binary compatibility. Current Droppy hosts refuse a descriptor whose grouped width is nil; nil does not use a standard grouped-width fallback.
preferredSoloWidth
let preferredSoloWidth: CGFloat?
Preferred width in points when the widget is shown alone.
This remains optional for source and binary compatibility. Current Droppy hosts refuse a descriptor whose solo width is nil; nil does not use a standard solo-width fallback.