by eswick, September 28th 2013
-----
So, here's what I've worked out so far. Most obviously, SBGestureRecognizers are very similar to UIGestureRecognizers, but meant to be system-wide. They share many functions in common, including these:
- (void)touchesBegan:(SBGestureContextRef)context;
- (void)touchesMoved:(SBGestureContextRef)context;
- (void)touchesEnded:(SBGestureContextRef)context;
- (void)touchesCancelled:(SBGestureContextRef)context;
I'm not exactly sure what SBGestureContextRef points to. Most likely some sort of array of touch data.
They also have a 'state' variable, which appears to conform to UIGestureRecognizerState. For the most part, this is very easy to understand. The part where I get stuck myself is at the initialization.
SBGestureRecognizer also needs a touch template (SBTouchTemplate). I'm not exactly sure what this entails. Initialization takes a CGPoint and a number of touches. SBGestureRecognizers can have multiple touch templates.
Recognizers also have two function blocks. One, 'canBeginCondition', must return true for the gesture to receive any events. The other, 'handle', appears to be the equivalent of the "action" argument in [UIGestureRecognizer initWithTarget:action:]
The main problem that I haven't yet seen solved is the initialization of the damn things. Gestures appear to be initialized in a function called by [SBUIController init], however, they appear to be removed and
re-created on *every* *single* *interaction*. This is the part where I am lost. I believe I know how to initialize the recognizers correctly, but I don't know what to add them to.
I have made a list of related functions I have found in SpringBoard (iOS 6.1.2) that may be of interest:
0x14A524 - Called by [SBUIController init]. Initializes the actual gesture recognizers for the system.
0x14C7B4 - Appears to be some sort of function to deliver the touches to the classes themselves. It does link back to 0x14A524 somewhere along the way, possibly explaining the re-creation.
0x14BCB0 - Checks if some variable is nil, has a dispatch_once call inside. Some sort of static variable, possibly an array containing a list of SBGestureRecognizers?
* I've created a page on the iPhoneDevWiki. Hopefully the information collected can be placed there.