Life of a SwiftUI View | Behind the scenes | in English

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 ก.ย. 2024
  • swift playlist: • Swift Programming | iO...
    swiftui playlist: • SwiftUI | iOS Mobile D...
    #coding #swift #ios #development #swiftcode

ความคิดเห็น • 7

  • @85muz
    @85muz 2 หลายเดือนก่อน

    When the value changed in the tree, is this re-render the complete view or re render only that particular component of screen?

    • @codewithmugish2651
      @codewithmugish2651 2 หลายเดือนก่อน

      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.

    • @85muz
      @85muz 2 หลายเดือนก่อน

      @@codewithmugish2651 You mean the complete screen? Not that particular component. Right?

    • @codeeffectively
      @codeeffectively  2 หลายเดือนก่อน

      Only the particular component is rendered

    • @85muz
      @85muz 2 หลายเดือนก่อน

      @@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.

    • @codewithmugish2651
      @codewithmugish2651 2 หลายเดือนก่อน

      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.