The important bit is that you need to use the mouse and touch events instead of the keyboard.
If you want touch controls only like touch left side of the screen move left, touch right to move right or on-screen buttons, an example is included with GDevelop for how to implement touch controls.
If you want swipe like swipe left to move left, swipe right to move right, you need to use variables to store the position of the initial touch and current touch and expressions to get their position, and compare the variables. If you are new to variables and expressions, I recommend to read the docs on the wiki first.
In a nutshell:
Get initial position
If Left mouse button or touch is down
Do = MouseX() to variable touchInitialX
Do = MouseY() to variable touchInitialY
Get current position
Do = MouseX() to variable touchCurrentX
Do = MouseY() to variable touchCurrentY
Compare them to see if there was a swipe or not
If mouse Left mouse button or touch is NOT held
If touchInitialX different than touchCurrentX
we swiped left or right do what you want to do and then
if touchInitialY different than touchCurrentY
we swiped up or down, do whatever you want to and then
However, the problem with the above solution is that, currently it is considered a swipe even if we slowly move our finger just a little bit in one direction.
To make sure it was an explicit swipe You might also want to use a timer to check the elapsed time between touching the screen and releasing it. If it happened within say 1 second, it could have been a swipe but if it was 2+ second, it was not swipe. Than you might also want to check the distance. If the user moved it finger only certain amount of pixels like say 200 pixels within <= 1 second only than you consider it a swipe. If it took > 1 second or the length is < 200 pixels than you don’t consider it a swipe. It is something you need to experiment with to get it right that feels natural that feels like a proper swipe.
Yeah, some swipe conditions could be useful to have