Can you access the objects in a struct from outside the struct?

Can you access the objects in a struct from outside the struct?

So far I have a group of HStacks and VStacks whose embedded objects are all Images(“name”).

By definition these Images are fixed in terms of their .position and .size for example.

Can I dynamically access these embedded objects from outside the struct?

In short, move them?

.. or include a Node so I could change its color?

All changes made from Swift outside the struct?

Replies

Yes you can, but following SwiftUI rules.

  • define State var for the positions of the object
  • declare Binding var in the outside struct
  • change values of those Binding vars to move the objects