Featured iPhone Development Resources iOS Development Libraries Open Source iOS Libraries And Tools

Open Source: Easy Multistroke and Single Stroke Complex Gesture Recognition On iOS

If you’ve ever wondered how to code gesture recognition for complex shapes I’ve come across a couple of open source libraries that should be a great deal of help.  This goes well beyond finger swiping.

This library is based on the $1 gesture recognizer which I remember being discussed quite a bit a few years back because not only did it run efficiently,  but allowed you define the templates to recognize complex shapes very easily.   The $1 gesture recognizer only recognizes 1 single stroke from the user.  The $1 gesture recognizer was later expanded on to become the $N multistroke gesture recognizer.

Brit Gardner has taken the $N gesture recognizer and created an Objective-C implementation of the code.

You can read about complex gesture recognition, and why Brit decided to use the $N gesture recognizer on his site in these posts:

Complex Gesture Recognition in iOS – Part 1: The Research
Complex Gesture Recognition in iOS – Part 2: The Implementation

You can find Brit’s Github for the Objective-C $N gesture recognizer here:

Adam Preble has created an implementation of the $1 gesture recognizer which can be found here:

You can try out the javascript versions, check out the full pseudocode, or download other versions of the gesture recognizers from the University of Washington here:

The $1 Gesture Recognizer
The $N Multistroke Gesture Recognizer

I’ve received e-mails a couple of times over the years asking about how some drawing games were created on the iPhone.  If you are looking to make that kind of game this should help give you a head start.

1 reply on “Open Source: Easy Multistroke and Single Stroke Complex Gesture Recognition On iOS”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.