I have a added a pan gesture recogniser for screen edge (left) edge. It is working well in portrait mode but in landscape orientation its not working.
override init() {
super.init()
//Pan Gesture for dragging Screen Edge
let panGestureFromScreenEdge = UIScreenEdgePanGestureRecognizer(target: self, action: #selector(panFromSide(sender:)))
panGestureFromScreenEdge.edges = .left
UIApplication.shared.keyWindow?.addGestureRecognizer(panGestureFromScreenEdge)
}
Don't add gesture recognizers to the window. The highest view with which you should be concerned is the window's rootViewController!.view
. Even better, if this is view controller code, add it to self.view
.