Hello @ZeTof
DragGesture
is a part of SwiftUI while RealityKit contains APIs for interacting with and composing entities for your ECS. SwiftUI and RealityKit are separate but compatible frameworks. Of course, when you use both SwiftUI and RealityKit in the same app you'll need some way to communicate between the SwiftUI and RealityKit (ECS) layers, and @radicalappdev is right to suggest taking a look at Transforming RealityKit entities using gestures since this project is an example of exactly how to do that.
To answer your first question, the best (and only) way to setup a DragGesture is to apply it to your SwiftUI View
with a gesture modifier.
To answer your second question, see the documentation for Composing SwiftUI gestures. You can't pass an array of gestures to a single gestures modifier, but you can use SequenceGesture
to combine multiple gestures to be processed in sequence or SimultaneousGesture
to combine gestures that should be processed at the same time.
A gesture and its callbacks are not part of the ECS. However, in the onChanged
and onEnded
closures for gestures you can modify your entities and perform queries on the scene, which should give you access to any ECS data you might want to modify.
Thanks for your question! Let me know if there's any thing else I can help you with.