Skip to content

Instantly share code, notes, and snippets.

@jacobsapps
Created February 1, 2026 22:06
Show Gist options
  • Select an option

  • Save jacobsapps/129a98e60f02f4a90146178c52f732ba to your computer and use it in GitHub Desktop.

Select an option

Save jacobsapps/129a98e60f02f4a90146178c52f732ba to your computer and use it in GitHub Desktop.
final class PressableView: UIView {
/* Lots of UI setup boilerplate ... */
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesBegan(touches, with: event)
setPressed(true)
}
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesEnded(touches, with: event)
setPressed(false)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment