Michael Long
Aug 17, 2024

--

Examples are simple enough when passing a dependency to a root view, but code starts getting a lot more complex when one needs to start chaining views in a navigation stack, or passing dependencies down a chain of subviews.

You provided environmentObject for that, but what happens when a view wants to construct a view model in the initializer, but isn't going to be able to see the environment until the view is evaluated?

--

--

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