_UISystemGestureManager

From iPhone Development Wiki
Jump to: navigation, search

The _UISystemGestureManager, introduced in iOS 13, handles gestures across the system. It can be used to add and remove custom gestures from SpringBoard.


Header: https://headers.cynder.me/index.php?sdk=ios/15.4&fw=PrivateFrameworks/UIKitCore.framework&file=Headers/_UISystemGestureManager.h

Adding a Gesture Recognizer across all of SpringBoard

self.pinchGestureRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handlePinchGesture:)];

FBSDisplayIdentity *displayIdentity = [[[UIScreen mainScreen] displayConfiguration] identity];
[[_UISystemGestureManager sharedInstance] addGestureRecognizer:self.pinchGestureRecognizer toDisplayWithIdentity:displayIdentity];

Removing a Gesture Recognizer from the system

FBSDisplayIdentity *displayIdentity = [[[UIScreen mainScreen] displayConfiguration] identity];
[[_UISystemGestureManager sharedInstance] removeGestureRecognizer:self.pinchGestureRecognizer toDisplayWithIdentity:displayIdentity];