David Cordero

iOS and tvOS developer at @Zattoo. Amateur Triathlete. Passionate about coding and lifelong learning.

Being a tvOS Developer

10 Jul 2017 » swift, tvos

It is already more than one year ago that I came to Zürich and joined Zattoo.

Zattoo is a small company based in Switzerland, dedicated to the distribution of television through the internet, regardless of the device the users have.

Among these devices are iPhone, iPad, and now that it has an App Store, the 4th generation of Apple Tv “recently” released by Apple.

And even though during this time I have been also working on our iOS App, the fact is that it has been tvOS where I have been more focused on.

image

TV Development

Due to its context and its type of devices, developing on a TV platform always leads to its own type of issues.

This is not the first time I face them. I worked in the past in the development of some other tv platforms, as Euskaltel Tv or Imagenio (nowadays rebranded as Movistar Tv), and there is a set of issues which always appear when developing for big screens.

Apple Tv is not actually an exception here.

  • Overscan: It is basically not safe to use all the area close to the edges of the screen, because everything in there could be cropped or even completely hidden depending on the user’s tv settings. Until now dealing with overscan in tvOS was a manual task, but thanks to tvOS 11 and the new definition of safeAreaLayoutGuide it will be much easier from now on.

  • Very long or even never ending sessions: as soon as you check the average duration of a user session in a big screen app, you will notice the huge difference with a standard mobile App. In big screens the users literally rest in the sofa for hours while making use of your App, not to mention the ones who only turn off the tv keeping the STB and your App alive in the background for days or even weeks. Memory management and efficiency in the consumption of backend resources are really important points here.

  • No screen rotations: which is actually not a problem but an advantage. Fewer auto layout issues make developers happier.

  • Focus based navigation: the bigger distance from the user to the device determines the way to interact with it. Due to the impossibility to use touch screens, a remote control allows moving the focus through the different interactive elements on the screen. Dealing with the focus is always a painful task, and because to the inefficiency of the Focus Engine in tvOS, it is even worse when working with Apple Tv.

  • Sizes: Everything is further, so everything has to be bigger, as simple as that. The best approach here is to follow the sizes defined by the human interface guidelines of the platform. In the case of Apple Tv, they can be found here.

  • Bandwidth: is not a hard limitation when working on big screen. STBs are usually connecting using ethernet to a high speed network. The main purpose of the box is to receive video, at least in HD nowadays. So to get a few JSONs from your backend should not be a big problem.

Specific Apple Tv development issues

Apart from the previous issues, the development of Apps for Apple Tv has its own particularities.

They could be summarized in three points, navigation, customization and reliability.

Apple Tv is by far the first STB with which I have worked with enough performance to offer a smooth user navigation.

With Siri Remote, Apple has introduced a completely new concept of navigation for TV.

In a world of remote controls with tons of buttons, Apple had the courage 😜 to release a box controlled by only six buttons and a little digitizer, having only two of the buttons and the digitizer available for developers.

image

Working with Siri Remote, in combination with the back stack logic of tvOS and the management of the focus, is one of the most challenging parts in Apple Tv. It requires compromises all the time, not only because there are just a few gestures available but also because many of them might be not allowed or even being reserved by Apple when using native components as AVPlayerViewController.

An example of this is the recent post I published about Directional Clicks on tvOS, in which you can see that the only way to detect those clicks is actually making use of the GameController SDK.

Customization

tvOS was not designed thinking about customization, and you will notice it since the very beginning.

Small tasks as changing the background color of a button, or to create custom cells in a collection view, might look like straightforward tasks at the beginning, but they are definitely not when working with tvOS.

If you are used to work with the iOS SDK, you will find a lot of constraints when trying to create your views for tvOS.

Imagine that you have to create the classic on boarding screen, a simple paged tutorial with a skip button, to be presented the first time that your App is launched. Quite simple right?

Well, what if I tell you that in tvOS UICollectionView does not support isPagingEnabled, and UIPageViewController does not allow having interactive elements on its pages?

Creating custom views in tvOS is not impossible, but you will notice that they are usually harder than initially expected.

Reliability

Apple Tv is buggy, or to be fair I should better say that tvOS 10 is buggy, because Apple is working really hard on bugfixing for tvOS 11.

The last year working with Apple Tv is by far the year that I opened more radars to Apple, it reminds me the times of iOS 7. And not only because of rare bugs in really weird scenarios but when making use of quite popular APIs.

Here you have a few examples just for fun:

On the other hand, I have to say that Apple is really taking care of these bugs, they do respond to radars, asking for more information or data, communicating the status of each issue and asking for verification once they have a fix.

Something that is also very important in this point, is that there is 0% of fragmentation in tvOS. There is only one box so far working with this operating system, and they all can of course be updated to the latest version of the system. You can see in the stats that it takes only a few days to have all your users updated to the latest version of tvOS.

Code interoperability and tooling

The core of tvOS is basically the core of iOS. The main differences among them are actually in the UI layer.

Because of that, all the business logic can be easily shared among both systems with just a few particularities like the persistency limitations in tvOS.

On the other hand, UI code is not that easy to share. Obviously not possible at all when using TVML, but neither with xibs or storyboards which are not compatible among the two platforms.

In terms of tooling, in general iOS tools work fine for tvOS, even when they do not have specific support for it. Fastlane for example is working pretty well for us in Zattoo, even though tvOS is not officially supported.

But you might also find some other tools like HockeyApp which don’t work in tvOS yet.

Conclusion

Apple Tv goes beyond being just a new STB, to create a complete new concept of the whole TV experience.

If you are an iOS developer willing to learn something new, keeping one foot in the comfort zone, I do recommend you start creating Apps for tvOS. You will find new challenges and a greenfield of new opportunities.