Now also a tvOS CMS: building tvOS apps with Contentful

October 13, 2015


Apple recently released the tvOS SDK, which helps developers build applications for the new Apple TV which will be shipping late October this year. Since we at Contentful want to help you bring your content to every screen, this article will give you a brief overview of building apps for bigger, Apple TV-powered screens.

tvOS overview

Like watchOS, tvOS is a variant of iOS, which is especially evident from its version number, 9.0, analogous to the just released iOS 9. Unlike on the watch, though, we can actually build truly native apps without hacks. The TV apps are using UIKit directly, and lower-level graphics frameworks like Metal or OpenGL ES are also available.

The major difference between tvOS and iOS is the interaction model: the Apple TV apps are controlled with a remote, not a finger. tvOS introduces focus model: the user can switch the focus from one view to another and perform actions on the selected view.

A few additions have been made to the UIKit to deal with focusing views:

UIButton().canBecomeFocused() // == true or false
UIButton().focused // == true or false
UIScreen.mainScreen().focusedView // nil or the view in focus

If you want to learn more about focus and designing for Apple TV, take a look this post on the Airbnb engineering blog and the comprehensive Human Interface Guidelines for tvOS.

Setting up the tvOS development environment

First, you would need to get the beta of Xcode 7.1, because of the tight coupling of components Apple does these days. I would recommend using xcode-install for this task, as it makes the management of multiple Xcodes much more pleasant and it performs an additional code-sign check as well. You can also download it manually from the Developer Portal, though.

$ [sudo] gem install xcode-install
$ export XCODE_INSTALL_USER=developer-apple-id
$ export XCODE_INSTALL_PASSWORD=developer-apple-id-password
$ xcode-install install '7.1 beta 2'

I am also assuming you are using CocoaPods to get the Contentful SDK, because there is no binary build for the tvOS branch, yet. If you wish, you can also integrate it manually. You will need a Podfile like this at the moment, as forks or special podspecs are needed for the dependencies as well:

platform :tvos, '9.0'

target 'tvful' do

pod 'ContentfulDeliveryAPI', :git => '', :branch => 'tvos'
pod 'AFNetworking', :git => '', :branch => 'tvos'
pod 'ISO8601DateFormatter', :podspec => 'vendor/ISO8601DateFormatter.podspec.json', :inhibit_warnings => true


You will also need a Gemfile to use a development version of CocoaPods:

source ''

gem 'cocoapods', :git => '', :branch => 'master'
gem 'cocoapods-core', :git => '', :branch => 'master'
gem 'xcodeproj', :git => '', :branch => 'master'

Time to install pods using bundler:

$ bundle install
$ bundle exec pod install

It is generally a good practice to start using bundler for any RubyGems required in your development setup, as it allows consistent versioning and an easier installation experience for new developers on your team.

If you need other dependencies for your TV apps which haven't been updated yet, you can either create forks or use cocoapods-expert-difficulty plugin for ignoring the platform specification from the podspec. Be aware, though, that some Pods might not work or may require source code changes – hence the name.

tvful example project

After setting up the tvOS development environment you can use the Contentful SDK in the same way as on any other platform – with the exception that some of the UIKit helper classes are not available. You can find a full example project on GitHub, which helps skipping some of the manual setup. The example project just shows a list of images inside a collection view, using the data from the Contentful gallery sample app.

About the author
Don't miss the latest
Get updates in your inbox
A monthly newsletter to help you build better digital experiences with Contentful.
add-circle arrow-right remove style-two-pin-marker subtract-circle