swifttvostvmltvjs

tvOS: Call into JavaScript from Swift for TVML app


I know calling into Swift code can be done from JavaScript (Call Swift code from an Apple TV TVML TVJS JavaScript App) but I'm wondering if the reverse is true?

Basically I have a long running asynchronous Swift function that will be made when the user interacts with a button on a TVML page and I need to call back into the JavaScript when its completed


Solution

  • As Roman suggested above. This answer (https://stackoverflow.com/a/33573770/1135276) did everything I needed. I've been using typescript so I had to play a little with the server side implementation but the patterns the answer used were exactly what I needed.