SwiftUI identifies which views require re-rendering by monitoring state changes. When a state variable that a view relies on is updated, SwiftUI will re-render only that specific view and its subviews.
@@codeeffectively Thanks to confirm. But my next question is if we changed the spacing or added Spacer(), other components will also get affected, then SwiftUI should re render the complete view as coordinate positions of the other components will also be changed.
See, when you change the state of variables, SwiftUI is smart enough to decide which parts of the view need to be refreshed. You can call those parts components.
When the value changed in the tree, is this re-render the complete view or re render only that particular component of screen?
SwiftUI identifies which views require re-rendering by monitoring state changes. When a state variable that a view relies on is updated, SwiftUI will re-render only that specific view and its subviews.
@@codewithmugish2651 You mean the complete screen? Not that particular component. Right?
Only the particular component is rendered
@@codeeffectively Thanks to confirm. But my next question is if we changed the spacing or added Spacer(), other components will also get affected, then SwiftUI should re render the complete view as coordinate positions of the other components will also be changed.
See, when you change the state of variables, SwiftUI is smart enough to decide which parts of the view need to be refreshed. You can call those parts components.