I can\'t get UIScreenEdgePanGestureRecognizer
to work when I create when I add it to my view controller using Interface Builder, so I\'m asking here to establish wh
It seems that there is a bug in Xcode 6.4’s interface builder and Swift. Also, Thomas LIU’s answer was also correct: it seems to be necessary to set the .edge property in code, rather than with Interface Builder.
Even though there are edge checkboxes in IB, they seem to be ignored.
I solved it this way: Ctrl-drag from the gesture recognizer to the viewController class to create an IBOutlet:
class ViewController: UIViewController {
@IBOutlet var leftEdgeGestureRecognizer: UIScreenEdgePanGestureRecognizer!
then, in viewDidLoad:
leftEdgeGestureRecognizer.edges = .Left
and finally, ctrl-drag from the recognizer to create an IBAction
@IBAction func swipeFromLeft(sender: AnyObject) {
print("===> Swipe from left edge.\n")
}