TVMLKit is able to leverage existing client-server architectures, but because I did not have one in place, the first step was to setup a simple server to host my JavaScript and media files. There are ways to set this up on the device, but for this test I started one on my Mac. Once that was setup and all my media was ready, I created the tvOS project in Xcode and headed over to the AppDelegate. To use TVMLKit you are expected to create a TVApplicationControllerContext and a TVApplicationController in application(_:didFinishLaunchingWithOptions:). This would also be the place to pass through other launch options to the TVApplicationControllerContext (think deep linking). One thing of note is that it takes very few lines of Swift/Objective-C code to get started. Once these two objects were setup, I was able to switch over to JavaScript to finish up the implementation. The TVML Catalog sample source code was a great resource for getting a head start on what the JS/XML template should look like. Here is what I ended up with:
Each of the items opens a media player with a HLS stream using the native player chrome and all. I feel the need to again emphasize this is a completely native experience written mostly in JavaScript. No web view wackiness here (there is actually no web view component even available on tvOS). Overall, I am impressed with TVMLKit and what it offers. The template I used did the heavy lifting of creating the collection views and laying them out to match the look and feel of the iTunes movies app. Implementing this experience from scratch using UIKit would indeed take more time and effort. If you have a catalog of media on a server somewhere and are looking a user experience that matches that of many of the apps on the Apple TV, TVML is a very good place to start.
