Daniel Ondruj4 min

First Time Eye to Eye with tvOS

EngineeringiOSOct 25, 2015

EngineeringiOS

/

Oct 25, 2015

Daniel OndrujiOS Engineer

Share this article

First impressions

Up until recently, there have been no major changes made to Apple TV, which first hit the market five years ago. It just worked well. One could use services like Netflix, HBO Now (the only TV device on the market), Watch ESPN and many others. It was a closed ecosystem. And, of course, it worked perfectly as a streaming device with other Apple devices.

But over the years, competitors like Amazon FireTV, Roku, Chromecast and Android TV (for real Android fans) have starting catching up and in some cases, started taking the lead. This all changed on September 26, when Apple opened the doors to all developers to create custom apps for this awesome device.
Officially, the fourth generation of Apple TV will be released at the end of October (no specific date has been announced). The price looks good to me -- 32 gigs for $149 or 64 gigs for $199.

As is Apple’s standard, the device is geared towards ordinary users, so it must be straightforward, super easy to use and full of great apps. To this end, Apple gave Apple TV developer kits to a bunch of developers so they could start creating amazing new apps before the device’s official release. I’m so thrilled I was chosen as one of these developers, allowing me to play around with this device and of course transfer few of my ideas into apps.

After trying the fourth generation for the very first time, I can report that it works as smoothly as the previous devices. The new touchpad remote control is very intuitive and easy to use, while the system’s focus engine displays a user’s moves and touches. All in all, the whole experience of controlling the TV is pretty awesome.

Programming

Basically, there are two different ways to develop apps. We can create Native or TVML apps. Both have pros and cons. The hardware is not as important as Apple users are typically used to. It just works. For hardware fans, we have a 64-bit A8 processor (iPhone 6), 32/64 gigs of storage, 2 gigs of RAM, Ethernet, Wi-Fi, 1080p resolution, HDMI and the new Apple TV Remote with Siri. While we’re talking about storage, third-party developer apps are limited to 200MB. Beyond this size, it is recommended to use on-demand resources. The biggest thing from my point of view is non-existing local app storage. All apps that want to save content need to use iCloud. You can use CoreData Framework, but there is no guarantee that your stored data will still be there.

TVML

Apple created a TV markup language for us, which allows us to quickly assemble the layout out of the predefined components. We have to create a client-server app, where the primary purpose is to stream media and use web technologies like HTTP-Live streaming or Fairplay. As mentioned before, the interface is powered by TVML, and we can control it using Javascript. We don’t have to write core Javascript on our own. We can use TVJS, which is a very handy framework.

Native

This is a classic development process used in iOS/OSX. You can write it with Objective-C or Swift and use frameworks. (However, not all of these frameworks are available for iOS, like, for instance, there’s no keyboard, no WebView, etc.) Basically, you would choose this option when you want to create a game or an app with more complex functionality.
You can use Metal, UIKit, SpriteKit, On Demand Resources and Game Center with Native.
Here’s another interesting fact: new or existing apps can target both iOS and TVOS. This gives developers an awesome multiplayer option if they are creating games. You can also give existing apps the ability to show some functionality/content on the Apple TV.
Use #define TARGET_OS_TV 1 macro when you want to create code targeted toward tvOS.

Top shelf

This is something similar to what all Apple users have long been familiar with. A user can just pick up to five favorite apps and open them quickly from the main screen. The iPhone 6S can now preview an app or directly target the location of a specific app. Same thing with the Apple TV. You can now directly open your favorite app or preview it from the Top Shelf.

Focus engine and parallax

This is partially done automatically. When a user highlights, for example, a button, this button zooms in, rotates slightly and displays a parallax effect. This means that the only thing you have to do is ask your designer to create a bunch of images which can be displayed via the parallax engine, giving an image something like glass effect when you scroll over it.

What now

You’ve probably read many articles about the Apple TV that run you through its features based on official documentation and some scheme pictures. We want to create apps where we can describe the development process from a practical side.

Here at STRV, we give iOS job applicants a simple test project. It's a weather app that shows the current weather and the weather forecast for next few days for a user’s current location. We think this might also be a great idea for a TV app. Imagine waking up in the morning, turning on your Apple TV to listen to music or watch the news and getting a weather update for the day within seconds.

We decided to try both options -- native and TVML. Stay tuned, and we will share our experience soon. Of course, we will go through Apple’s review process, so you can try our small app on your own. We’re going to make our repo public, so it can be used as learning material as well.

Share this article



Sign up to our newsletter

Monthly updates, real stuff, our views. No BS.