Passing EnvironmentObject to all subviews

Hello,


I have created an instance of EnvironmentObject in SceneDelegate and using it everywhere in the application without explicitly passing it to any component, and my application is already working as expected without any issues, however I'm asking just in case there's something I need to consider.


Do I need to pass the instance of EnvironmentObject to all subviews that will use this environment object ?

Answered by Claude31 in 404248022

This is well explained in WWDC (video 226 @29'30)


https://developer.apple.com/videos/play/wwdc2019/226/


Note: you'd better move the thread to SwiftUI

Accepted Answer

This is well explained in WWDC (video 226 @29'30)


https://developer.apple.com/videos/play/wwdc2019/226/


Note: you'd better move the thread to SwiftUI

Thanks!

Passing EnvironmentObject to all subviews
 
 
Q