TLDR; If the user drags their finger over multiple nodes, how can I get all the nodes they touched while dragging?
I'm trying to build a Wordsearch-like game to teach myself SwiftUI on iOS.
I've built a grid of tiles as shown (ignore blue colour tiles as they are not relevant for my question).
I'd like the user to drag their finger over the grid, and for every tile they swipe over, I'll call a method on my model to mark that tile as "selected".
I've tried a DragGesture on each tile's view, like so;
.gesture(
DragGesture()
.onChanged { _ in
myModel.SelectTile(self.tile.id);
}
)
However as the user's finger moves out of the starting tile and into the next, the next node's drag gesture is not actioned until the user lifts their finger and starts a new gesture on that tile.
Is this behaviour possible with SwiftUI? I realise I can probably do this more easily with SpriteKit but that seems a little overkill for this kind of "game".
