For Videoland I got the opportunity to develop a new app for tvOS. There was already an app for the Apple TV, but that app wasn’t modern enough and was a separated codebase.

The talk I gave at AppDevCon in Amsterdam, was focussed on how you can build an app for tvOS based on your iOS codebase. When using your iOS codebase (instead of making a copy), you only have to develop the layout for TV and some TV specific screens.

Maintain one codebase

When you start developing a new app for tvOS and want to reuse your iOS code, don’t copy your whole project. Just add a new target in Xcode with the tvOS app and add all the files needed to that target. By doing this, you only need to maintain one codebase and if you develop a new functionality for iOS, you’ll get tvOS for free!

You can only use the codebase for both iOS and tvOS, but are not able to add a layout to the target for tvOS. This is because most of the layouts for TV may look different than mobile.

Some UIKit components are unavailable on tvOS

Not all UI components from UIKit are available for tvOS. Some of them are unavailable, because it has a bad user experience on TV. The components that are not available, are the UISwitch, UISlider and UIStepper. Also the WKWebView is not available for tvOS, which can me it hard to allow authentication for TV.

Some apps are based on oAuth, which means you have to develop a different login flow. Most apps for tvOS gives the user the option to login using a linking code. That is a temporary number which can be filled in on the website or mobile device, and will allow the user to connect the account to the TV.

Focus-based navigation

Apps for tvOS are controlled by the Apple Remote, which means the navigation for tvOS is focus-based. Because of this, you have to show the user where the current focus is. Most of the time this is done by bringing the focussed UI element to the front with 10% extra zoom. For buttons, we also decided to change the color.

The focus to next objects on the screen is automatically done by tvOS operating system. There may be some situations where the focus is not working as expected. You’ll need to implement a focus guides for those situations.

Watch the talk!