Michael Long
1 min readAug 24, 2020

--

Not quite following this w/o a code sample, but I’ve found that it’s rare to call .objectWillChange() directly, at least in SwiftUI. If you have an error you can just update the error state.

Also not sure about the “at the right time” comment. In SwiftUI, user interface updates happen well after the aggregate state changes have occurred during an asynchronous update scheduled for the next run cycle.

In essence, doing objectWillChange isn’t doing much more than throwing a flag saying, “Hey, you’re probably going to need to redraw things when you have a chance…”

--

--

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