Created
September 28, 2018 10:21
-
-
Save elpsk/0b33c5b00670ab078b22f0162169ce85 to your computer and use it in GitHub Desktop.
Swift - Undo text using Shake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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