79273163

Date: 2024-12-11 21:07:31
Score: 0.5
Natty:
Report link

Got a response from an Apple engineer on how to correctly handle this:

.onPreferenceChange(HeightKey.self) { [$height] height in
  $height.wrappedValue = height
}

I feel a little sheepish for not realizing this earlier.

The approach that avoids preferences by @Benzy Neez is also a good one.

Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
Posted by: smr