Move with pointer

Hello there! I would like to build a game in SwiftUI where you can move an object with your mouse (for example: a rectangle points your mouse, and it goes where your mouse goes).
How can I do it?

You have to add a gesture (here DragGesture):

https://www.hackingwithswift.com/quick-start/swiftui/how-to-add-a-gesture-recognizer-to-a-view

Move with pointer
 
 
Q