Sort of. You can write your own templates, but it involves a few different parts. Also, I don't know of a way for custom written templates to interact with the NavigationDocument. So, you're limited to either:
- All Apple templates
- All custom templates
- Apple templates with some custom leaf templates.
By (3) I mean that you use Apple templates to drive the majority of your pages, but they the last pages you push are full screen modal views that simply cover up the NavigationDocument template stack.
Assuming you'd like to try (2) or (3), read on.
Native Part
First, you need the native part. This is either Objective-C or Swift code that you use to build UIKit based classes that can display your custom UI and handle events.
The native part uses JavaScriptCore to expose itself to the JavaScript runtime in the TVApplicationControllerDelegate
's -[appController:evaluateAppJavaScriptInContext:]
method.
I'd recommend Objective-C for this because the syntax required to work with JavaScriptCore is simpler.
Template Processing Part
This can be either JavaScript or native. It reads your JSON or XML data, creates the native objects via the interfaces you previously exposed, and then map the JSON/XML values into the properties on your native objects. Finally, you need to present the view to the screen, either covering up the NavigationDocument template stack or by using your own custom navigation stack.