2

I am using the dragGesture in SwiftUI to develop my game. I am facing a problem with iOS Reachability Swipe Gesture. When user tries to swipe down at the very bottom of the device, iOS calls iOS reachability. I need to disable this iOS feature for my app. I checked this link:

Disable iOS Reachability Swipe Gesture in iOS game.

Below function seems to be the answer for UIKit:

override func preferredScreenEdgesDeferringSystemGestures() -> UIRectEdge {
    return [.bottom]
} 

How can I use this function and disable iOS Reachability Swipe Gesture in SwiftUI?

Bank
  • 57
  • 1
  • 8
  • Are you using the UIKit or SwiftUI lifecycle? – jnpdx Mar 05 '21 at 19:31
  • I am using the SwiftUI lifecycle. – Bank Mar 05 '21 at 19:34
  • Hm. That may be rough. My suspicion is that you'll have to subclass `UIHostingController` to override that property, which I guess you *could* do inside another `UIViewControllerRepresentable`, but that's much uglier than just doing it at the root level in your `SceneDelegate` – jnpdx Mar 05 '21 at 19:39
  • How to disable (UIKit) ONLY swipe-down (bottom) reachability gesture? – sabiland May 05 '22 at 06:12

0 Answers0