Categories

Developing for Apple TV Part 1: The Familiar

23 Sep 2015
CM_AppleTV_FeatureImageFinal

In light of Apple’s September keynote and the latest Apple TV announcement, Chaotic Moon presents a three-part series on what to expect when developing for Apple TV: the familiarities, the differences, and what we can expect in the future. Looking for part two or three?

The Apple TV has been getting small incremental updates since its initial release in September 2010, but considered a pet project by Apple, it never received the level of attention as the other iDevices–

Never, that is, until now.

During the September keynote, Apple made an announcement, completely altering the role of the Apple TV in users’ homes and presenting an entirely new avenue for developers to explore.

“We believe the future of television is apps,” Apple CEO Tim Cook said when introducing the Apple TV part of the program, and the proceeding news supported that assertion–particularly the arrival of the tvOS SDK.

Now the Apple TV has run a modified version of iOS since its inception, and while some big name companies (Netflix, Hulu, HBO, etc.) have been able to partner directly with Apple and get their apps on the device, most third-party developers haven’t been granted access. However, this recent announcement means that anyone with an Apple developer account can create an app and have it placed in the soon-to-be-open Apple TV section of the app store.

To encourage development, Apple even created a lottery of sorts for dev kits, through which a few lucky registered iOS developers received the hardware early and could begin experimenting. Given this sneak preview of sorts–and given the fact that many iOS developers have been waiting years for this moment–there are a huge number of apps expected to hit the market soon.

Here at Chaotic Moon, we may have gotten our hands on a few dev kits (#NoBig), but for those who weren’t so lucky, we’ve created a three-part piece on developing for the Apple TV. In this post, we’ll dive into the elements of development that haven’t changed much, and the familiar aspects developers can expect when it comes to the tvOS SDK.

To start off, Xcode 7.1 is an option to create a tvOS project, just as it is for any other type of project. There does not, however, appear to be an option for a universal app that can be deployed to iPhone, iPad, and Apple TV, which means that developers will need to create a separate binary for a TV app. However, tvOS is based on iOS 9 frameworks, which can be used to share code across all three device types.

Another aspect that hasn’t changed much is that tvOS supports a subset of the current Cocoa framework, so getting started on an amazing app should be straightforward for any iOS developer. Apple has provided a list of differences between iOS 9 and tvOS for reference (it’s available here), and there are some notable pieces of framework that aren’t included in the tvOS. While some of the omissions make sense–like Contacts, CoreMotion, PassKit, and MapKit–others (HomeKit, NotificationCenter and WebKit) are more surprising.

When it comes to interacting with the Cocoa framework, Swift 2.0 or Objective C are still the go-tos. Familiar storage options like Core Data are available, but file system storage on the device is not, and this inability to store large files is interesting given the fact this is the first time the Apple TV has hard-drive size options of 32 and 64 gigabytes.

One significant element that was included in tvOS is UIKit, which means that user interfaces for an app can be created using all of the familiar tools. Developers who’ve heeded Apple’s gentle suggestions over the past few years and have adopted modern UI creation techniques such as storyboards, collection views, Auto Layout etc. should have zero problems providing their users with solid custom UI, and when it comes to dealing with varying screen dimensions, Auto Layout is definitely a developer’s friend.

In terms of adjustments being made on other tools’ ends, popular third-party libraries such as Alamofire have already started to adapt their code to tvOS, meaning that many of the same helpful tools will be available soon. Hopefully this low bar to entry will encourage development for the Apple TV so we’ve all got a stocked app store to choose from when it hits the market

After all, that candy isn’t going to crush itself.  

###

Looking for part two or three?