Skip to content

Instantly share code, notes, and snippets.

@viccc
Created January 10, 2016 14:34
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 viccc/86664ff069aad1cc9bde to your computer and use it in GitHub Desktop.
Save viccc/86664ff069aad1cc9bde to your computer and use it in GitHub Desktop.
Shake to execute some code for debugging. To be inserted into view controller.
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
#if DEBUG
// Shake to debug
becomeFirstResponder()
#endif
// ...
}
#if DEBUG
private func shakeToDebug() {
// ...
}
override func canBecomeFirstResponder() -> Bool {
// Shake to debug
return true
}
override func motionEnded(motion: UIEventSubtype, withEvent event: UIEvent?) {
// Shake to debug
shakeToDebug()
}
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment