Michael Long
Apr 11, 2024

--

Should note that your terminology here isn't quite correct.

A state change will cause a view body to be evaluated. If the results of that evaluation differ from the previous evaluation, then the view will be rendered to the screen.

Just because an evaluation occurred doesn't mean a render cycle has occurred.

As to closures not being equatable, that's true. But that's really impossible anyway. You could, at best, check for closure equivalence (===), but there's no way to check for equality since one can never be sure what state the closure has captured.

Not terribly fond of final solution as managing the UUID is problematic, could simply be best to use .id(value) on the subview such that SwiftUI is notified of changes.

Really liked the article, but the first paragraph is pretty messy and almost didn't get past it. Might want to clean it up a bit.

--

--

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.

No responses yet