Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where are the gesture recognizers for the iOS 13 undo/redo gestures?

New in iOS 13, three gestures are interpreted as asking for undo and redo:

  • Double tap with three fingers means undo.

  • Swipe left with three fingers means undo.

  • Swift right with three fingers means redo.

Where are the gesture recognizers that detect these gestures? What would I do to override them, turn them off, or arbitrate between them and my own gestures?

like image 269
matt Avatar asked Oct 24 '19 18:10

matt


1 Answers

Looks like there's a private class called UIUndoGestureRecognizer that is attached to a UIEditingOverlayGestureView which lives in a UIInputSetContainerView inside a UITextEffectsWindow. (To figure this out, I put a breakpoint inside an UndoManager's registerUndo handler and tried swiping left with three fingers, then poked around in the resulting stack trace and assembly code until I found the gesture recognizer instance.)

You could probably use the methods in UIGestureRecognizerDelegate to arbitrate between your gesture recognizers and these system ones, and you could override editingInteractionConfiguration in your view controller or view to return .none in order to just turn them off completely.

like image 194
TylerP Avatar answered Nov 15 '22 09:11

TylerP