Last week, amongst many new things, Apple announced an update to the Apple TV. It now runs on a new operating system named tvOS and includes an app store allowing third-party apps. These apps can be developed using many frameworks and concepts quite similar to iOS ones (Foundation, UIKit and CoreGraphics), but also some new APIs like TVServices.
We were eager to find out if it was possible to run NativeScript on this new platform.
The second step to running NativeScript on Apple TV was feeding our metadata generator with the new tvOS SDK. We had to make some minor tweaks to the way we invoke the Clang compiler which we use to generate metadata about native APIs, but after that it worked like a charm.
This allowed us to use all tvOS specific APIs immediately and any future ones will be generated automatically based on your local tvOS SDK.
After that, it took less than a hundred lines of code to make a beautiful proof of concept app running on the Apple TV simulator:
In this example we are utilizing a
UIPageViewController with some images downloaded from imgur. The result is a slideshow-like screen that can be navigated with the Apple TV Remote. You can find the full source code on GitHub.
Feel free to clone the project and experiment with it and tell us what you think. The future of Apple TV looks very promising and we will be watching it closely to see how it progresses.
If you plan to work on tvOS, please get in touch with us so that we can work together and help you build your solution. The best way to get in touch is to open an issue on GitHub.
Here are also some great resources if you want to learn more about Apple TV apps: