Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Gestures with Switch Case

How do I just gestures with switch case? I've made an iOS calculator app, where I use switch case to alternate between operations, but I want them to be triggered by gestures. Any help would be greatly appreciated!

2 Answers

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher

You would probably want to use Gesture Recognizers to first detect the gestures, then call a method based on the gesture or maybe assign a code that you could use in a switch statement. The hard part is recognizing the gestures, though. Once you tap into those you can do whatever you want for each gesture. :)

Thank you! That's what I was looking for