How does the buttons in DemoBots for tvOS work?

I'm building a SpriteKit game and I don't really know how to add focusable buttons. I've tried to understand how they do it in DemoBots but can't seem to grasp it. I get how they make them appear focused, but not how the user input translates to focus changes. Does anyone know?

Do you have a spcific spot that you are haveing an issue follwoing the code?

If I understand it correctly then it's the 'controlInputSource:didUpdateDisplacement:' delegate method that causes the navigation between buttons. It seems to be called from 'registerMovementEvents' in GameControllerInputSource.swift, but I don't really get how the movementHandler is attached to the Apple TV remote.

How does the buttons in DemoBots for tvOS work?
 
 
Q