0

I have a Flutter game and it is not unlikely that a user puts 3 fingers on the screen. iOS 13.0 introduced three finger tap to open an edit menu and three finger swipe left/right to undo/redo. I want to disable this feature for the whole app.

What I learned from Google search results is that this can be controlled by the editingInteractionConfiguration property that many classes inherit from UIResponder.

In UIResponder it is defined like this:

@interface UIResponder : NSObject <UIResponderStandardEditActions>

// ...

// Productivity editing interaction support for undo/redo/cut/copy/paste gestures
@property (nonatomic, readonly) UIEditingInteractionConfiguration editingInteractionConfiguration API_AVAILABLE(ios(13.0));

@end

---

@available(iOS 13.0, *)
public enum UIEditingInteractionConfiguration : Int, @unchecked Sendable {
    case none = 0
    case `default` = 1 // Default
}

I'm no Swift expert and my attempts to set this to none were adding the override below to my AppDelegate that inherits from UIResponder and overriding it in the FlutterViewController but it did not work:

// Class assigned in main storyboard view controller
class GameFlutterVC:FlutterViewController {
    override func viewWillAppear(_ animated: Bool) {
        print("This gets printed.");
        super.viewWillAppear(animated)
    }
    
    // Disable 3 finger tap gesture on iPad (not working)
    @available(iOS 13.0, *)
    override var editingInteractionConfiguration: UIEditingInteractionConfiguration { .none }
}

(using code from https://www.hackingwithswift.com/example-code/uikit/how-to-disable-undo-redo-copy-and-paste-gestures-using-editinginteractionconfiguration)

Any idea what I am doing wrong?

RobDil
  • 4,036
  • 43
  • 52
  • All view controllers, views and a few other objects are responders. You just disabled it for one object. I’m thinking you need a base view controller where you override it and have everything else inherit from it. – cora Sep 15 '22 at 00:34
  • Hi @cora, that is exactly what I try to do but I don't know where? I have a default Flutter app. iOS native code has a storyboard with just one view controller and an app delegate. – RobDil Sep 15 '22 at 13:29

0 Answers0