//MARK: SHAKE GESTURE
extension ViewController
{
//- We are willing to become first responder to get shake motion
override var canBecomeFirstResponder: Bool {
get {
return true
}
}
//- Enable detection of shake motion
override func motionEnded(_ motion: UIEventSubtype, with event: UIEvent?)
{
if motion == .motionShake
{
print("ACTION HERE")
}
}
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.