Directional clicks on tvOS

David Cordero
Jul 10, 2017 · 2 min read

If you have tried to detect directional clicks on tvOS you might have notice that it is not that easy.

Checking the documentation of UITapRecognizers and UIPressType, you will find an interesting list of available press types:

But as soon as you try to use them, you will notice that the types upArrow, downArrow, leftArrow or rightArrow are only triggered as result of a tap gesture. And when you click on the touchpad of Siri Remote, the only gesture that is triggered is select, regardless of the position of your finger during the click.

In addition to that, in tvOS, there is no way to get the precise location of the finger in the digitizer from an instance of UITouch. In fact, in order to avoid people creating pointer-based applications, the coordinates of any gesture in Siri Remote always start from the center of the touchpad wherever you actually start the gesture from.

GameController SDK to the W̶O̶R̶K̶A̶R̶O̶U̶N̶D̶ RESCUE !!

Thanks to GameController SDK we can have a lower level of abstraction with the controllers engine. And, lucky for us… it does allow getting the absolute directional pad values from the controllers (in our case, from Siri Remote)

So, we could get the directional pad information…

… and depending on that, to process a different action whenever the gesture with type .select is triggered:

Show me the code:

I have created this simple project that detects directional clicks on Siri Remote with the method previously described.


Feel free to add me on github, twitter or dcordero.me if you have any question.

David Cordero

Written by

iOS and tvOS developer at Zattoo. Amateur Triathlete 🏊🚴🏃 Passionate about coding and lifelong learning.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade