Swiping/Tracing Shapes with finger

I was curious if there was a way already built into the engine that would allow you to track a finger pattern in some sort of 2d shape (triangle, square, etc…)? Or if there are any suggestions on how I would achieve this (for both Android and iOS). Essentially what I’m trying to implement is a mini-game within my game that would track the accuracy of tracing the outline of whatever shape is displayed on the screen. Any help is appreciated!