2

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

Community
  • 1
  • 1
StackJP
  • 1,450
  • 2
  • 16
  • 32
  • 1
    Have you seen this answer http://stackoverflow.com/questions/33081565/how-to-bridge-tvml-javascriptcore-to-uikit-objective-c-swift ? If so please provide some code that is not working for you. – Roman Podymov Dec 16 '16 at 14:00
  • Thats exactly what I was looking for... my googling had failed me. I'll try that out and either close this question or update it based upon what is going wrong. Thanks @RomanPodymov – StackJP Dec 16 '16 at 17:04

1 Answers1

2

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.

Community
  • 1
  • 1
StackJP
  • 1,450
  • 2
  • 16
  • 32
  • I voted to close as a duplicate but until then in case people fail to find the other answer the same way I did. – StackJP Jan 10 '17 at 16:10