i have the similar problem where i have an array that conforms to a model, and it's being used in a lazyVgrid and a foreach loop. the issue is that when an array elemant get changed the whole foreach get redrawn. Can you help me solve that? or can you make a video about that.?
Thanks! If you simply place print inside the view, it will complain that the body does not conform to the View protocol. However, when you assign it to a variable, it works. Since we are not using this variable, it can be ignored with an underscore.
Great simple example, well done :)
Thanks Dave!
i have the similar problem where i have an array that conforms to a model, and it's being used in a lazyVgrid and a foreach loop. the issue is that when an array elemant get changed the whole foreach get redrawn. Can you help me solve that? or can you make a video about that.?
I made a video about how to prevent SwiftUI from re-rendering views ruclips.net/video/TOmxDvCz7e4/видео.html is your issue similar to this one?
recomputes body is more accurate way to say "re-renders"
Simple and useful 👌
Why the “let _ =“ before the print?
Thanks!
If you simply place print inside the view, it will complain that the body does not conform to the View protocol. However, when you assign it to a variable, it works. Since we are not using this variable, it can be ignored with an underscore.
Ohhh, ok. Thanks for the explanation 🙏