Skip to content

Instantly share code, notes, and snippets.

@jazzedge
Created December 21, 2017 00:27
Show Gist options
  • Save jazzedge/b8ff66306750e940d5d6eb3bc69605a5 to your computer and use it in GitHub Desktop.
Save jazzedge/b8ff66306750e940d5d6eb3bc69605a5 to your computer and use it in GitHub Desktop.
See:https://www.hackingwithswift.com/example-code/uikit/how-to-detect-edge-swipes
override func viewDidLoad() {
super.viewDidLoad()
let edgePan = UIScreenEdgePanGestureRecognizer(target: self, action: #selector(screenEdgeSwiped))
edgePan.edges = .left
view.addGestureRecognizer(edgePan)
}
@objc func screenEdgeSwiped(_ recognizer: UIScreenEdgePanGestureRecognizer) {
if recognizer.state == .recognized {
print("Screen edge swiped!")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment