From iOS to tvOS: The Key Differences Apple TV Developers Need to Know

by: | Nov 30, 2015

As longtime iOS developers, we at ArcTouch were excited when Apple gave us early access to the new Apple TV test units. This fourth-generation Apple TV includes an app store for the first time, so, just as soon as we got our hands on the test units, we jumped right in and started building an app.

In three weeks’ time, we finished a humble but addictive game called Echo. The goal of our project, as our product manager Mark Goedicke wrote in his blog post, was to build a great app in time for the App Store launch — but also to learn a lot in the process, and share those learnings.

For developers, the introduction of an entirely new operating system, tvOS, was big news when Apple announced it at WWDC this year. But in building Echo, we found that if you already know iOS, it’s not that big of a leap to become Apple TV developers.

BUILDING ECHO: A blog series on developing for the Apple TV

From iOS to tvOS: common gene pool for Apple TV developers

tvOS uses the same programming languages as iOS (Objective-C and Swift). The tools to build interfaces are the same, and you can use storyboards, xib files and Auto Layout constraints — just as you do in iOS projects. There’s also a built-in simulator for tvOS in Xcode — so aspiring Apple TV developers could start building apps for Apple TV even if they don’t have one.

Though the technology foundation is the same for iOS and tvOS, there are some important differences between the two that Apple TV developers need to understand, starting with frameworks. Almost all of the frameworks available on iOS are also available on tvOS — but there are three new ones that you’ll need to get to know.

Three new frameworks for Apple TV developers

Of the dozens of frameworks in tvOS, all but three of them are available and well known by iOS developers. Here is what Apple TV developers need to know about the new TVML, TVJS and TVServices:

  • There are two approaches for tvOS app development: the fully native approach, which uses Objective-C and/or Swift, Storyboards, XIBs, etc.; and the second approach and new to most developers is using new frameworks TVML and TVJS. Think of TVML as similar to HTML, but specific to tvOS apps, and constrained by the look and feel of interface components recommended by Apple. TVML and TVJS have been refined now that tvOS is open to developers, but the technology has been around — and in fact, this is how previous generation Apple TV apps were built.
  • The TVServices framework is used to describe the app’s content to tvOS and how it should be presented to the user. Users can pick which apps to display in the Top Shelf, and through the TVServices, framework developers can customize what information to display.

The image at the top of this post is what we’re currently displaying in the Top Shelf for Echo.

Also interesting to observe are the frameworks that are missing in tvOS. Even though it’s understandable why some frameworks were left out (ex: AddressBook, MessageUI), others will certainly be missed (ex: WebKit, MapKit, HomeKit).

The screen dimensions in tvOS

Besides all the technical similarities, there are some important differences between building an app for a TV screen and for phone or tablet-sized screens. We’ll write more soon about how to approach design for the living room. But from an implementation point of view, there are a few things that you need to know. With iOS apps, you need to build interfaces that accommodate a variety of different screen sizes and scales (1x, 2x, 3x). But on tvOS, there’s a fixed screen size (1920×1080) and scale (1x).

The new Siri Remote control

The new Apple TV comes with the sophisticated Siri remote control, including a touch surface that can detect different gestures — the same gestures we’re familiar with in iOS, including swiping, tapping, and clicking. Similar to a Wii remote control, it also contains an accelerometer and gyroscope to detect movement and position, so other gestures like shake can be detected. In Echo, our core gameplay mechanics are driven by swiping, clicking and shaking — as users see an action on screen, they respond with one of those three gestures.

The two different ways to interact with a screen in tvOS

There are two different ways to interact with the Apple TV using the remote control. The first one is using Siri and the second one is using the touch surface. Siri can be activated using the microphone button. Fundamentally, Siri for Apple TV operates in the same way it does on an iPhone. So today, I’m going to focus on the touch surface.

With the touchable display on an iPhone or iPad, the user can use gestures directly on the screen and the app itself. The Apple TV interaction is unique in that the user is using similar gestures, but on the remote and NOT the screen itself.

The way the tvOS provides visual feedback to the user is through its focus engine. There is always an object in focus on the screen, and by swiping on the remote surface, users can change which objects are in focus, and then click the items they want to select.

As Apple TV developers, you don’t need to implement anything in particular. The focus engine automatically focuses based on the user input (swipe up/down/left/right) and the distribution of the focusable views in your app. Of course, if your app requires a different type of control, it is possible to change this default behavior using some of the new APIs.

Parallax images

One of the tools that the focus engine needs to function is parallax images, which Apple has introduced for the first time in tvOS. As a user swipes to navigate the screen, layered images will rotate at a slightly different rate, creating a parallax effect. This gives users the feedback they need to see their swiping motion on screen as they navigate to the item they want to select. Apple made it very easy for developers to implement parallaxes by extending the already familiar UIImageView component.

App size and storage

Apps cannot exceed 200MB in size. This doesn’t mean that content rich apps are constrained by size. As your users experience your app, for example in a multi-level game, you can add content beyond this 200MB limit using the On-Demand Resources API — which was originally introduced with iOS 9 and now is also available in tvOS. It’s also important to note that other than basic settings, there is no persistent storage in the device. Instead, apps need to use iCloud or their own backend.

From the personal device in your pocket to your living room screen

tvOS app developers like us are only starting to explore the potential of the new Apple TV, now that Apple has officially invited us into the living room by introducing an app store.

We use apps on our phones for everything: for checking the weather, playing games, reading the news, and so much more. Bringing apps to the television will change how we interact with our biggest screen. It’s going to be much more customizable, and much more personal. And in the social hub of the home, it will be much more fun to share these experiences with our family and friends.

Now it’s up to Apple TV developers like us to deliver on that promise — and I couldn’t be more excited about it.