I\'m developing a app with a gesture system, basically if I turn the iPhone to left my app will do a function, if I turn the iPhone to Right, other function, with others ges
swift Docs:- https://developer.apple.com/documentation/uikit/uiresponder .
To detect motion events swift has provided 3 methods:-
func motionBegan() -> Tells the receiver that motion has begun
func motionEnded() -> Tells the receiver that a motion event has ended
For example if you want to update image after shake gesture
class ViewController: UIViewController {
override func motionEnded(_ motion: UIEvent.EventSubtype, with event:
UIEvent?)
{
updateImage()
}
UpdateImage(){
// Implementation
}
}