SwiftUI: detect force click and modifier key pressed

I’m using SceneKit to render some spheres and cylinders so I’m using NSViewRepresentable protocol to import the SCNView to SwiftUI.

Then I’m using the view as any SwiftUI view.

I need to detect some gestures in order to move the camera and make my 3D objects rotate.

For instance, I’m using the DragGesture to rotate the camera.


What I was used to do with Storyboards is, in the NSViewControler, to detect force click and also flagsChanged to detect the press of modifier keys such as shift or control.

I’m using that together with NSPanGestureRecognizer in order for instance to translate the objects instead to rotate them (if no modifier key is pressed).


So my questions are:

1) Is there a way to detect force click with the trackpad in SwiftUI? I haven’t found anything in the Gesture. I can use LongPressGesture but it's not the same.

2) How to detect key pressed, in particular modifier keys during a Gesture is SwiftUI?


Best regards


Vincent