Pick the fix
A clock label updates every second, and a heavy chart on the same screen re-renders each tick. Best fix?
Hint 1 of 1
Which view actually needs the time?
Choose an answer, then open Show answer below to check it.
Show answer
Answer: A Move the clock into a small ClockView using TimelineView(.periodic(from: .now, by: 1))
Correct. Only the clock depends on time now.
Why not the others?
- B Add .drawingGroup() to the chart. That speeds up drawing; the chart's body still runs every second.
- C Tick every 5 seconds instead. It hides the cost and makes the clock wrong.
- D Wrap the screen in AnyView. Type erasure makes diffing worse, not better.