New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting Swipe Gestures to Nil Doesn't Disable Swipe Gesture #59
Comments
@mbalex99, dig a little deeper! Both You need to either remove the gestures from the view or disable them. Read up on |
Hmm it didn't seem to work. I tried this: SideMenuManager.menuRightSwipeToDismissGesture?.enabled = false
SideMenuManager.menuLeftSwipeToDismissGesture?.enabled = false and even on this on both the side viewcontroller and the main viewcontroller
The swiping still seems to occur. |
You can't disable it if you set the reference to nil. Also I think the gesture is recreated every time the menu is exposed. Take a look at the code to understand more closely. |
Thanks for the quick replies.
I'm taking a look at the code right now and I can't seem to figure out why the gestures are still being fired. |
Try removing them in |
I created a test project here. I think either this is a bug or I'm obviously missing something. |
There is still more to try before calling this a bug. Your code has you disabling it in In Instead, in |
https://github.com/mbalex99/swipesidemenuissue I pushed those changes and added some explicit code. Okay I did what you said, doesn't seem to be working. I checked and the gestures are never nil at |
So yeah I've tried everything and it's still swiping. If it's this difficult or unintuitive wouldn't that be respectable to say it's a bug by now? Again thanks for swift support! 👍 |
Disabling them in However, it's important to note that it's disabling those gestures on the menu itself, but not on the main screen that's partially displayed. The main screen has a transparent view over it to take taps and swipes to hide the menu and prevent the partial screen from being interacted with. The gestures were separated this way so that they could be disabled on the menu in case of special menu gestures but still make it easy to dismiss the menu. As such, this is not a bug, but by design. As a general note, my goal with this library was to hit the 90%+ use case, and I think it's accomplished that. If you would like to contribute to this library, I'm all for it! I haven't heard of a compelling use case for turning off the swiping gestures from anyone else yet. If you want to contribute, I would suggest taking a look at line 310 of |
Are you using the same code from my project? I have the code in the MenuViewController at Ah I see what you did there with the transparent overlay, but since the SideMenuManager is managing a singleton instance shouldn't the disable/enable of the gesture recognizers still disable it for all instances? |
I added two lines of code to disable gestures to the example project in the repo and it worked as expected. A challenge with the design is that a storyboard will create a new instance of a SideMenu via segues, vs. setting up the right and left menus on first launch. Since a new menu instance can be created at any time, many of the commands related to menus are not singleton oriented, but hooked to the singular instance of that menu when its assigned to the manager. It could be re-architected to move the gesture from menu to menu or use a master boolean to control behavior, but again in light of the 90%+ use cases there was no need for that level of effort. |
Okay! I created a fork and a pull request! |
@mbalex99 I don't see any pull requests. |
@mbalex99 disregard just appeared. |
I would also like to see this feature implemented. Looking forward to the pull request merged. |
its here 👍 |
As you can see I've set both swipe gestures to
nil
however, I'm still able to swipe and dismiss the controller. What am I doing wrong?The text was updated successfully, but these errors were encountered: