How To Get Started with tvOS and Apple TV

Amid all the hype of Apple’s September iPhone and iPad Pro announcements, Apple introduced its new Apple TV--seen as a graduation of the product from hobby to full-on entertainment, gaming and development platform. That's a big deal since Apple TV heretofore was a passive entertainment box that sat underneath the television, with pre-defined channels such as Netflix and Hulu. Indeed, it was really known more for what it didn't have--such as apps in the App Store or third-party app ecosystem--than for what it did.

(source: Apple)

This has now changed, of course, as the new Apple TV sports much more robust hardware--with more RAM and an A8 processor to match what Apple has on its iOS devices. All of this supports the introduction of tvOS, an SDK that opens up Apple TV to third-party developers and enables them to create the same immerseful and engaging games, apps and Netflix-style video platforms we are accustomed to on iOS.

No longer is the Apple TV a second-class citizen in Apple’s app-driven ecosystem. In this article, we will teach you how to start building for the Apple TV and tvOS.

What is tvOS?

tvOS SDK enables developers to develop for Apple TV--a platform that had previously been closed. This fact is all the more surprising when you consider Apple TV was first released way back in 2007 (the same year that the iPhone was released).

Built for the new Apple TV, which also boasts the ability to interact with one’s television using the bundled Siri Apple tv Remote, tvOS allows third-party developers to build (or extend their existing) apps using the traditional iOS frameworks, in the familiar Swift or Objective-C, by allowing their apps to conform to protocols that can be responsive to the new remote navigational control gestures (as opposed to the touch gestures we are more accustomed to on iOS).

Apple has also provided another, more interesting path for developers who want to create Netflix-style video-hosting and -consuming apps: A new custom markup language, TVML, acts as a javascript bridge between native iOS code and the Apple TV user interface. And although the app is still built as a binary app, it loads javascript files (TVML pages) to display user interface content, without having to go too deep into Swift or Objective-C.  Instead, Apple provides a whole bunch of TVML templates.

image: ../Art/ATV_temps_alert_2x.png
(source: Apple)

TVML makes use of traditional Web networking technologies such as HTPPS, XMLHTTPRequest, DOM and other javascript libraries to acquire content to display on TVML templates. Each TVML page represents one UI screen/page, which is composed of various UI elements.

Each template page uses compound and simple elements. Compound elements contain other elements, while simple elements are single lines of TVML. Elements contain the information and images that are displayed on the screen. (source: Apple)

Why Build for tvOS and the Apple TV?

With tvOS and the new Apple TV, unlike the more established Apple ecosystem platforms, such as iOS, developers have the opportunity to develop for a platform that is really at its embryonic stage--where fewer apps are available and competition isn’t as fierce for mind share. This presents a golden opportunity for developers to establish a platform presence, provided their app use case is applicable to televisions.

No matter what app you develop for Apple TV, it's very important that you consider the user experience--and how it is alike and different from the user experience with other Apple devices. For example, the Apple Watch experience is intimate and personal, as the device is worn on one’s wrist. The Apple TV takes the other UX extreme of being a shared experience. Design and functionality need to be conducive to shared living-room experiences, as well as enjoyable when shared with others (such as with games and share-able apps.)

Guitar Hero, which has made itself famous on other platforms, including iOS and gaming consoles like XBox, has announced that a  tvOS app is on its way. When you think about the app being played on the Apple TV with one or more controls (remote or even a game control), you can really see the value. AirBnB is another app that will make its way to the big screen (the big TV screen, anyway)--and one that makes sense as a shared-engagement experience.


Moving from iOS to Apple TV

If you already have an iOS app, extending it to the Apple TV is a relatively straightforward process. It's all about conforming your UI to certain design principles, while also extending certain protocols. If you have a simple video-sharing app, you can also jump into the tvOS bandwagon without having to invest as much time (or resources) with Swift and Objective-C; you simply work with javascript templates.

Getting Started

As we mentioned, there are two approaches to tvOS development: custom apps and TVML. With TVMLKit being a completely new framework--consisting of TVML, TVJS and TVML--let’s start-off first with that.

TVMLKit: An Architectural Overview

In a TVMLKit-powered app, your primary AppDelegate connects to a javascript file that defines what the user interface of the app is, rather than purely running Objective-C/Swift code. You would go down the TVMLKit route only if your app was simple enough that it could be represented by one of the 18 various Apple TVML templates that would generally make up a Netflix-style app. If your app requires greater sophistication, you should instead go with a Custom App.

Doron Katz A keen passion for emerging technologies, practices and methodologies, Doron embraces the vision of lean development with continuous customer development. Consultant for various startups, as a Project and Product Manager, with a mobile engineering background in iOS, and over 10 years of professional web development experience.