For the first time since Apple introduced the Apple TV in 2007, independent developers can now build applications for the hardware, thanks to Apple’s release yesterday of the tvOS software development kit (SDK).
The demo of the revamped Apple TV with tvOS flew by during Apple’s big Hey Siri event. But the tvOS code and documentation are out there now, so developers can take a look and see if they’d like to build for it. And non-technical types purely interested in the new Apple TV can also get a sense of its capabilities by taking a peek at the developer tools.
We checked it out, and so should you. To help you along, I’ve put together a brief overview of what’s out there and what developers can do right now. (Hat tip to developer Rick Walter over at Made Up By People for making a great tutorial video on tvOS, which inspired this article.)
Getting the tvOS SDK
The brand-new Xcode 7.1 beta integrated development environment (IDE) comes with tvOS and its SDK, so you’ll want to start by downloading that. You’ll need the latest edition of OS X Yosemite, version 10.10.5. Fair warning: Updating your Mac could take 15 minutes or longer, and downloading the 4.57GB Xcode beta file won’t happen instantly, either.
Once you have the new Xcode running, select “Create a new Xcode project” in the pop-up window, then “tvOS,” and then “Single View Application.” Give your app a product name and an organization identifier. Choose either Objective-C or Apple’s Swift programming language. Set it up with Core Data and unit tests if you want, hit Next, and then save the app to your desktop.
Hit the Play button at the top left corner of the window. At this point you may have to enable Developer Mode on your Mac and type in your computer account’s password. A Simulator application will pop up. You can make the window smaller by going to the Window dropdown menu, selecting “Scale,” and choosing, for instance, the 75 percent option.
To use a simulator for the remote, go to the Hardware dropdown menu and click “Show Apple TV Remote.” Hold down the Option key and use your trackpad or mouse in the black square on the Apple TV Remote in order to simulate using your finger to swipe on the real remote. A long press on the remote simulator (achieved by holding down the Option key and holding your mouse button down on the black square) will allow you to drag and drop an app to different positions in this menu.
You can alternatively use the arrow keys on your keyboard to navigate. You may have to hit the Menu button on the remote simulator a couple of times to get that to work.
First, get a feel for the settings of the Apple TV.
Use the arrow keys or the remote simulator to select “Settings” and hit Enter. Note that the Menu button on the remote brings you back a screen. Unlike many iOS apps, Apple TV apps will not generally include Back buttons.
You can do a lot with Settings. You can control screensaver options, sleep options, the style of closed captions, screen contrast, motion, parental controls, iTunes Store purchasing capabilities, multiplayer support, and location services. You can limit ad tracking, too.
Settings is where users will sign in to iTunes to use apps and iCloud for storing app data. Users can sign in to Game Center here also, as well as configure AirPlay.
You can connect remotes other than the official one for the new Apple TV, and you can turn on high-definition previews of video content in iTunes, depending on the speed of your Internet connection. You can also decide if you want Apple TV to update its software automatically or manually.
Now you can go try building an app for the new Apple TV. So go back to the Xcode application.
Building a test app
In the project navigator — the left column of the window — you’ll find components typical of apps for iOS, like AppDelegate, ViewController, and Main.storyboard. Go to Main.storyboard. In the second column, click the triangle to expand the View Control Scene section, and then click the triangle to expand the View Controller section.
With View Controller selected, click on the little square wedged between the curly braces and the rectangle near the bottom side of the right column of Xcode — it represents the object library — and in the text box at the very bottom, type in “button”, and drag a few of them into the big blurry box just to the left, which is the View Controller. Hit the Play button at the top left again to see how it looks in the simulator. (You may need to set the active scheme again as “Apple TV 1080p” under the tvOS Simulator bar to the right of the Stop button.)
Navigate around using either the arrow keys or the remote simulator. (Apple has best practices for app design in prerelease documentation for tvOS here.) Go back to Xcode’s object library and look around for other things you can add, including an Activity Indicator View, a Progress View, and a Navigation Bar.
If you wish, you can customize how your app appears when it’s placed in the Top Shelf, the place where Apple TV users can glance at featured content from their five favorite apps. Go to the File dropdown menu, select “New,” and select “Target,” click “Application Extension” under tvOS, and hit “Next.” Give the Top Shelf content a product name and hit “Finish.” Xcode will ask if you want to activate this scheme, and you should click “Activate.” Then the Top Shelf content will show up in the left column. Click the triangle to expand that section. The ServiceProvider.swift file is the important one for adding content like images to the Top Shelf.
Inside the ViewController.Swift section in the left column in Xcode, you can use the new Tap Gesture Recognizer, the Swipe Gesture Recognizer, and other user-experience inventions for the new Apple TV.
To explore a bunch of buttons, photo views, and other user interface options for tvOS, download the new UIKit Catalog sample code. Unzip the file and run the project UIKitCatalog.xcodeproj. Then hit the Play button.
Apple has also prepared sample code for client-server apps, which display content in the new Apple TV markup language, or TVML. After you download and unzip the file, open the TVMLCatalog folder, run the TVMLCatalog.xcodeproj file, and hit the Play button. If you run into errors here, follow the instructions at the bottom of the project’s README.md file in Xcode.
Parallax Previewer app
You can install and run the Parallax Previewer beta app to see how certain images will look with Apple’s nifty Parallax effect, which is invoked when you hover over an app and gently move your finger around on the remote’s swiping surface.
Using the app is as easy as hitting the Plus Sign on the bottom left, uploading an image, and then clicking the Play button in the center at the bottom of the application.
You can get slightly different effects if you turn the image into an Apple TV icon, and you can change the background as well. If you want to have some fun, try moving your mouse around the box in the middle of the application. You can export customized parallax images in .LSR format.
The sample game that Apple showed developers to demonstrate iOS 9 earlier this year is also available for developers looking to understand tvOS.
You can find it online. Unzip the file, select “Swift,” and open DemoBots.xcodeproj. Make sure to select “DemoBots (tvOS)” from the Active Scheme menu near the top left in Xcode. Then press Play. This one will take a minute or so to load. Hit the Play-Pause button on the remote simulator to get started.
This little run-through isn’t enough to help us determine whether the new Apple TV app ecosystem is likely to become as popular as the ones for iPhones and iPads. Still, developers have a lot to play around with, and based on what we’ve seen, there will soon be many more Apple TV apps for consumers to choose from.