Skip to content

Instantly share code, notes, and snippets.

@elpsk
Created September 28, 2018 10:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elpsk/0b33c5b00670ab078b22f0162169ce85 to your computer and use it in GitHub Desktop.
Save elpsk/0b33c5b00670ab078b22f0162169ce85 to your computer and use it in GitHub Desktop.
Swift - Undo text using Shake
override func motionEnded(_ motion: UIEventSubtype, with event: UIEvent?) {
if motion == .motionShake {
if (<#textField#>.undoManager?.canUndo)! {
self.<#textField#>.undoManager?.undo()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment