Michael Long
Oct 27, 2024

--

First approach, that of storing the viewbuilder and not the view, is not recommended.

The following article explains the pitfalls, but it basically works against SwiftUI's optimizations and against the diffing mechanisms used to determine view redraws.

https://rensbr.eu/blog/swiftui-escaping-closures/

--

--

Michael Long
Michael Long

Written by Michael Long

I write about Apple, Swift, and SwiftUI in particular, and technology in general. I'm also a Lead iOS Engineer at InRhythm, a modern digital consulting firm.

Responses (1)