How to disable touch outside to dismiss and swipe in Side Menu Swift

I find a problem where I need to disable side menu to dismiss. So basically it's just showing side menu and view controller behind it. I use library because I look it simple and it support swift 5.

I need to custom it because in my side menu I have parent and children so I need to customize it manual. But in here I don't tell you how to do it because my focus is to disable touch outsude and swipe. Sometimes you need to do it in some UIViewController. And Side menu library don't explain it explicitly. So I need to figure it out by myself and it's not harder to do find it out.

In Side Menu it works with gesture so I need to get all gesture and disable it according to what I want to disable. In this case swipe gesture and touch outside. You can see in my code I put it in ViewDidApper and ViewDidDisappear because I just want disabled feature in this only UIViewController.

ViewController is ContentViewController that side menu use.

So here in this code, I just disable the gesture contentContainerOverlay. If you see through the library code. contentContainerOverlay UIView takes action to dismiss the side menu when touch anything outside side menu.

Popular posts from this blog

How to restart the app with flutter Android and iOS

How to have ConstraintLayout inside ScrollView and ScrollView inside ConstraintLayout Android

Missing system image Android Studio solution