Possible with touchscreen controls?

I was wondering if anyone knew if I’m able to create a specific swiping technique in my game? After setting up a 3d environment I placed an enemy target that attacks you. To block each of the enemies punches I want to know if I can set up a touchscreen mechanism which allows you to block each attack by swiping his punches?

You have to code something yourself, so for example with a swipe you would be checking the direction, speed, and distance, you could even check the angle of the swipe, and from that information you would decide what constitutes the action you’re looking for.