I'd like to set a EdgePanGesture to change my ViewController when the user swipe from left or from right direction. With only one direction it works perfect:
func addingEdgePanDetection() {
let edgePan = UIScreenEdgePanGestureRecognizer(target: self, action: #selector(screenEdgeSwiped))
edgePan.edges = .left
view.addGestureRecognizer(edgePan)
}
but, as you can read in Apple' documentation edges is UIRectEdge type and it conforms de OptionSet Protocol so
You can add these constants together to specify multiple edges at the same time.
I've tried three different ideas with no success:
1.- edgePan.edges = [UIRectEdge.left, UIRectEdge.right]
2.- edgePan.edges = UIRectEdge.left | UIRectEdge.right
3.- edgePan.edges = UIRectEdge(rawValue: UIRectEdge.left.rawValue | UIRectEdge.right.rawValue)
any idea? I'm looking for an answer with only one gestureRecognizer. Thanks!