Skip to content

Instantly share code, notes, and snippets.

@andresilveirah
Last active August 19, 2020 10:02
Show Gist options
  • Save andresilveirah/24d1d8bd5e11199b2c7554fec0299fcc to your computer and use it in GitHub Desktop.
Save andresilveirah/24d1d8bd5e11199b2c7554fec0299fcc to your computer and use it in GitHub Desktop.
Using the SP SDK with Apple TV

Apple TV

There are 2 ways of developing apps for Apple TV. They are known as Native and TVML. Native is quite straight forward and works pretty much the same as an iOS app with all of its native components and lifecycle methods. TVML is a client-server based. Views are built using predefined templates by Apple or using the markup language provided (TVML).

Native

It's possible to reuse almost the entire SDK with a few remarks:

  1. There's no WebView. Therefore, we can only leverage the native message. Since we do not yet support a native PM, we're only able to support 1st layer messaging.
  2. The code will need a bit of a refactoring. Since a big chunk of the SDK relies on the existence of the WebKit module, we'll need to conditionally load code for different platforms (iOS or tvOS).

TVML

After applying the changes to make the SDK reusable on tvOS (described above) we are able to support TVML as well. With the same caveats as the native approach, no webview, no external browser.

Conclusion

With medium effort we'll be able to support AppleTV but only the 1st layer message at this time since the PM is not yet "Nativeable".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment