Search code examples
iosswiftgoogle-mapsuigesturerecognizergesture

Add gesture recognizer to allow horizontal swipes on a MapView in Swift


I'm working on an app that uses a snapchat style navigation system where the user can swipe horizontally between view controllers. The problem is that one of the view controllers is a map and once the user scrolls to the map, they can't scroll back because the map interprets all gestures as being map related. How could I implement a horizontal swipe gesture control that would allow the user to swipe horizontally (from right to left) to get out of the map view controller?


Solution

  • The solution to this is to add edge to edge gesture recognizers overlaid over the map view. These recognizers would span the vertical and horizontal edges of the view and when the user swipes from the extreme edges of the screen, the snapchat navigation system would be toggled