I am developing an app in SwiftUI where i can place an object on detected plane on screen tap. However i need to give screen location to implement
arView.raycast(from: CGPoint, allowing: ARRaycastQuery.Target, alignment: ARRaycastQuery.TargetAlignment)
In UIKit i can easily get location with the handleTap function using the method below
arView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(handleTap(recognizer:))))
@objc func handleTap(recognizer: UITapGestureRecognizer){ let tapLocation = recognizer.location(in: arView) }
How can i implement this in swiftUI structs to place objects on plane where tapped?