In one of the final chapters of “Steve Jobs” by Walter Isaacson — Steve was quoted saying “It will have the simplest user interface you could imagine. I finally cracked it.” He was, of course, referring to Apple TV.
It wasn’t long after that Steve unfortunately passed away, and since then many of us have been eagerly anticipating this product. Yesterday on September 9th, 2015 — more than four years later — we were finally presented with what may possibly be Steve’s vision, or perhaps just the beginning of it.
Yesterday’s announcement was super-exciting for us as iOS developers, because Apple announced that the new Apple TV will have an App Store that we can develop apps for – leveraging much of our existing iOS knowledge and opening many new opportunities.
I and the rest of the Tutorial Team have been digging into the tvOS SDK and are already hard at work preparing some tutorials on tvOS (stay tuned!), but to tide you over in the meantime, I wanted to share my initial impressions of tvOS from an iOS developer’s perspective.
Let’s dig in!
The original Apple TV was a set-top box that provides users with a simplistic user interface designed primarily for navigating and viewing video content. The new Apple TV announced yesterday expands this to full-blown apps for things like shopping and even games.
Let’s took a look at the critical info:
- Hardware specs: Notable specs are 64-bit A8 processor, 32GB or 64GB of storage, 2GB of RAM, 1080p resolution, HDMI, and a new Siri Remote / Apple TV Remote (more on this later).
- Price: The new Apple TV is priced at $149 and $199 for 32GB and 64GB models, respectively. This came as a surprise to many, as they had been expecting to see higher price points.
- Release date: Apple has given a vague release timeline of “Late October” but provided developers access to the tvOS SDK immediately. This isn’t much time to prepare, so if you want to have something ready for tvOS launch I suggest you move fast!
- Development hardware: Apple has announced a program that allows “proven” developers to request an Apple TV Developer Kit, which is an early access Apple TV to use for testing. From the sounds of it you’ll be lucky to receive one; but if you’re serious about trying to hit launch date it’s worth a shot.
By this point, it should be obvious that developing apps for the new Apple TV is a thing, and it’s a great thing!
When developing for Apple TV you will be developing for tvOS — the name coined by Apple as the device’s operating system. tvOS is built upon iOS and lends many of the same frameworks that you may already be familiar with.
In order to develop for tvOS you will need to download Xcode 7.1 from the developer center. This is a beta version of Xcode that includes support for tvOS, and a tvOS Simulator. You can install the Xcode 7.1 beta alongside Xcode 7 GM if needed.
Apple has provided two methods of developing apps on tvOS:
- TVML Apps: The first uses an entirely new process utilizing TVML, TVJS and TVMLKit. This was a big surprise to many of us – we’ll dive into this further in a moment.
- Custom Apps: The second uses familiar iOS frameworks and concepts you know and love like Storyboards, UIKit, and Auto Layout.
When you develop an Apple TV app, it appears to be a separate target (which implies that tvOS apps would be a separate purchase for customers). However, in the keynote Apple said there would be support for “universal purchases” where customers could purchase an iOS and tvOS app for a single price. We’re not quite sure how that works yet – maybe some support in iTunes Connect to link the two targets is coming?
As mentioned, the first method of making apps is via TVML, TVJS, and TVMLKit. If these abbreviations sound foreign to you, don’t fret because they should. Here’s what they are:
- TVML is a form of XML and stands for “Television Markup Language”.
If you’re a native iOS developer the thought of these might make you wince a little bit. But keep an open mind, there is some great power to all of this.
Here’s a very typical use-case for apps on Apple TV. Consider the following: you have content on a server and you want to display that content to users. Your content is organized in a predictable manner and navigating it should be intuitive and familiar. You want your tvOS app to feel at home with other apps. You’re not interested in pushing the envelope on cutting edge user experiences and designs.
If this sounds like you and your app’s requirements, you may want to consider TVMLKit. Apple has put a lot of work into providing reusable templates that will be familiar to the user, there are in fact 18 of them as of this writing. Many of them allow you to create stunning interfaces that feel right at home on the user’s television. You can browse the templates in the Apple TV Markup Language Reference which I would highly recommend.
I also recommend running the TVML Catalog sample app to view each template in action in the tvOS simulator. Be sure to check out the
README.md file as you’ll be required to start a local web server to host the content for the app to access. Don’t worry, it’s a single terminal command.
There is truly a ton of content to cover on this topic and it is very much worth your while to consider TVMLKit as an option for building your app. At this point in time I would recommend it to be the first point of consideration for apps that primarily provide menus of content. However, if you’re aiming to provide a fully immersive experience in your app, where your users will be spending more time interacting with your interface than passively watching or listening to content, then it is time to move on to developing a fully custom app.
When you need to get down to the nuts and bolts and provide a one-of-a-kind experience you will need to brush off your iOS skills and work your UIKit-fu.
Many of the iOS frameworks you know and love like UIKit, Core Graphics, SpriteKit, CloudKit, and more are available on tvOS – you can see the whole list of what is (and isn’t) included here. If you are an existing iOS developer, you should feel very empowered by this list!
Writing a tvOS app can be done using both Swift, Objective-C and C (I have not seen anything to say C++ is off limits either).
Although there’s definitely a lot of new material to learn about making custom apps for tvOS, you should feel right at home as an iOS developer.
One concept that will be new to iOS developers is the user input method. Users will not be touching your UI with their fingers or noses (you know you’ve done it or at least thought about it!). But rather, they will be using the provided remote control or even a game controller.
tvOS introduces a system known as the focus engine. The main concept is that there is always one — and only one — item that is in focus at a given time. Users navigate your UI by using swipe gestures or a directional pad/control to move up, down, left or right.
The focus engine automatically decides which view to focus based on user input; you don’t have to do anything. For example, you just arrange your views in your Storyboard, and if one of the views is focused and the user swipes right, the focus engine will automatically find the closest view to the left of the selected view and focus it for you.
As a developer, there are some new APIs related to the focus engine you’ll want to be aware of. There are APIs for your app to get notified when the focused item updates, to programmatically trigger a focus update, and much more. For more info, check out the Supporting Focus Within Your App section of the App Programming Guide for tvOS.
Although tvOS development relies primarily on iOS frameworks you may already be familiar with, there are a few new frameworks to be aware of, such as the new
TVServices framework is primarily used to describe content in your app so that the system can display it on the “Top Shelf”. When a user places your app in the top row of their home screen your app is considered one of the most important apps that the user has installed.
This is an excellent opportunity to provide extra value to your users by giving them shortcuts to content they may be interested in. For a game, it may be game saves so they can jump right back into the action. For a social media app, you may have trending content that appears on the top shelf. And a photo sharing app may show off recently shared pictures by friends and family.
Check out the TVServices Framework Reference for more information on how to implement this feature. It is very important that you take full advantage of this opportunity.
One thing that may have struck you as a little odd in the Keynote was the presenter’s emphasis on parallax effects happening on images and app icons. This is a really neat visual effect, but what’s so important about it?
As you play around with the tvOS simulator you’ll begin to understand why it’s so important: to move the focus item, you need to swipe a fair bit to the left or right. But if you swipe a little bit (but not far enough) Apple will begin to rotate the focus item, in order to give you a visual cue that you are doing something (but need to continue swiping to change the focus). It’s subtle but powerful.
Apple considers the parallax effect a key component of tvOS design. It is required of your App’s icon and highly encouraged for other media such as movie poster art.
Thankfully, Apple has outlined exactly how to create these assets in the Creating Parallax Artwork section of the App Programming Guide for tvOS, and has even provided a neat previewer app.
Everyone who buys the new Apple TV will receive a powerful new remote control. The previous generation was very simple with a directional pad and couple other navigational buttons. The new Apple TV remote has some exciting new features, specifically:
- A glass touch surface at the top which allows the user to perform gestures like swipes, taps and clicks.
- A microphone which provides access to Siri (Siri is restricted to a certain subset of countries) and the ability to control volume on your TV or audio system.
- A gyroscope and motion sensor to provide a great gaming experience. The user can tilt the remote side to side perhaps to steer a car down a street or hero running through caverns.
You can use gesture recognizers you know and love to detect swipes and taps, and there are also new
pressesCancelled() APIs to detect when various buttons on the control are selected.
The remote communicates using Bluetooth, which leaves the door wide open for Bluetooth game controllers (especially since the default remote isn’t particularly well suited to games IMHO). Apple has already announced that the Nimbus Steelseries Controller will be available for the new Apple TV. Check out the Working with Game Controllers section to learn more.
tvOS and Games
We’re willing to bet that games will be really hot on tvOS – Apple seems to be aiming squarely at Nintendo’s casual games market.
tvOS has strong game support. SpriteKit and SceneKit both work on tvOS, and in the keynote the Crossy Roads developer showed a tvOS port of their game, which is made in Unity, which implies Unity support may be coming in the future as well.
Many SceneKit games port almost seamlessly to the Apple TV. For example, Ray ported Zombie Conga from iOS Games by Tutorials to the Apple TV in less than 10 minutes, without even having to change any code:
This ease of porting games is sure to boost Apple TV’s initial games catalog!
Perhaps two of the most puzzling aspects of tvOS are the limitations imposed on local storage and app size.
Limitation: Local Storage
Starting with local storage… there is none! If your app needs to persist any user data you must do so using iCloud, CloudKit, or your own back-end service. Any data that you store on device is not guaranteed to be available the next time your app is opened. Furthermore if you want to synchronize data across devices you will need to store it somewhere else.
This is important to keep in mind as you design the architecture of your tvOS apps. Here are some rules of thumb:
- If your data storage requirements are less than 1MB, iCloud’s key-value store is a valid option; just remember that iCloud KVS access is strictly limited to the owner and cannot be shared to other users.
- If you need to share events or data with other users, CloudKit is a good option.
- If you are making a cross-platform app or have specialized needs, you may wish to use your own back-end service.
Limitation: App Size
Another limitation is that your app size cannot exceed 200MB.
But before you flip your table, think back to WWDC 2015 and the “On-Demand Resources” APIs that were introduced – it’s almost as if Apple planned this! :]
These APIs provide the ability to reduce the initial installation size of your app by downloading resources on demand. Developers can tag assets in Xcode and the App Store will automatically split tagged content into downloadable bundles upon submission. When the user needs the tagged resources you can request them to be downloaded to the device. You would ideally anticipate the content needs and download them before the user needs them so they do not notice the load times.
A simple example of this approach is a game that has 10 levels. You may opt to include only the first 2 levels when the app is installed. Once the user finishes level 1 you send a request to download the assets required for level 3 so that when the user finishes level 2, level 3 is ready to go. You’d then continue to do this as the user progresses through the game.
While this may seem annoying and painful as a developer, you can think of the user benefit. Rather than waiting for your 1GB game to download, they can perhaps download 100MB and start playing right away. A possible unfortunate outcome is that the user has a poor Internet connection and prefers to queue up downloads overnight. Downloading the next 900MB of your game as they play through may result in a terrible experience. Unfortunately as tvOS developers our hands are tied in this scenario.
Where To Go From Here?
There is a lot that can and will be done on tvOS! So prepare your couch; if you don’t have a designated “groove”, you may before year’s end :]
And remember: this is only the beginning. iOS didn’t even have cut, copy, and paste until iOS 3.0!
I believe that this platform can truly reinvent the way we use our TVs. Aside from the obvious gaming and content viewing use-cases, there are many areas for developers to innovate.
Here are some resources to learn more about tvOS:
- tvOS Documentation: Apple’s official tvOS documentation; a bit sparse at the moment but I’m sure more is coming soon.
- RWDevCon: If you’d like to learn about tvOS, you should come to our upcoming conference; we’ll be having a tons of hands-on tvOS tutorials there and will get you up-to-speed.
What do you think of the Apple TV and tvOS? Please join us in the forum discussion below!