Relative Content

Tag Archive for variablesswiftuiviewlet

SwiftUI view running twice

I have a view that draws some lines and filled circles. But to know the position of these lines I need to dynamically calculate them as they are being drawn.
I have two issues.
The first is that for some reason, the view code runs twice on the first load messing up the array lastYPos; but if I resize the window, the code runs once and it works fine.
The second is that I use “let _ = ” to change the value of variables, and I believe that this is a bad practice, but I cannot think of a better way to do it.