I have a custom keyboard extension and its containing app. After launching, containing app send to my extension a number every 2 seconds. I catch it and output to the text field. But I have a problem. When extension keyboard appears on a screen - it starts to receive numbers. But when it disappears it still receive numbers.
Question: how to stop receiving numbers when my extension is hidden?
Edit: I run my extension receiver in an infinite loop. How to exit this loop if keyboard is hidden?