SwiftUI dynamic positioning of a subview

Hi,

I'm trying to figure out how to manually position a subview within a view using SwiftUI.

For example, when the user taps the screen, I want to place a small icon on the screen at the position tapped.

I know how to get the coordinates of the tapped location but I don't know how to either place a view there or move an existing view already being shown to that location.

In a regular non-SwiftUI app I can set the frame, or set up constraints. I don't know what the best approach is in SwiftUI.

Thanks.

You may want to try offset or position.

SwiftUI dynamic positioning of a subview
 
 
Q