TVOS
An Introduction for iOS Developers
Eric Hyche, Mobile API Tech Lead
Groupon Consumer iOS Team
DOCKET
• Demo of hardware
• Types of apps
• Drill-down on Focus
Engine
• Build a FlickrTV app
• Resources
• Q&A
THE HARDWARE
• 64-bit A8 processor
• 32GB or 64GB storage
• 2GB RAM
• 1080p resolution
• Siri Remote
SIRI REMOTE
1. Glass touch screen
2. Menu (back)
3. Siri/Search
4. Play/Pause
5. Home
6. Volume
7. Lightning Charging
SIRI REMOTE
• Swipe
• Tap
• Click
SIRI REMOTE
• Swipe
• Tap
• Click
SIRI REMOTE
• Swipe
• Tap
• Click
PARALLAX IMAGES
• Made up of layered
images
• Can produce them with:
• Xcode
• Parallax Previewer
App
• Photoshop plugin
LIMITATIONS
• Max size of app bundle is 200MB. If greater, must use On-Demand Resources
• Limited persistent storage
• 500KB
• Accessed through NSUserDefaults
• Persistent storage > 500KB
• For < 1MB, use iCloud Key-Value Storage
• For > 1MB, use CloudKit
• Must implement your own user accounts, since device has only one iCloud account
• No UIWebView
LIMITATIONS
• Apps have to be submitted as BitCode
binaries
• This includes embedded frameworks
• Most closed-source 3rd party frameworks
won’t be usable on tvOS
THE GOOD NEWS
• Can usually assume high-bandwidth, low-
latency networks
• Screen size always the same (1080p)
• Don’t have to worry about rotation, size class
changes
TYPES OF APPS
• Games
• DemoBots Sample
(https://developer.apple.com/library/tvos/samplecode/DemoBots/I
ntroduction/Intro.html#//apple_ref/doc/uid/TP40015179)
• TVML-based apps
• TVMLCatalog Sample
(https://developer.apple.com/library/tvos/samplecode/TVMLCatalo
g/Introduction/Intro.html#//apple_ref/doc/uid/TP40016505)
• UIKit-based apps
TVML-BASED APPS
• TVApplicationController
is created in App
Delegate
• Attached to key
UIWindow and
UIApplicationDelegate
• Everything else handled
by accessing Javascript
and TVML
UIKIT-BASED APPS
• Most of tvOS is a subset of iOS
• Most ideas from UIKit translate directly
• Check the iOS/tvOS API diffs in Release
Notes
• https://developer.apple.com/library/tvos/rel
easenotes/General/tvOS90APIDiffs/index.h
tml
INDIRECT VS DIRECT
• Direct Interaction (iPhone, iPad, etc)
• Swipe left, content moves left
• Indirect Interaction (tvOS)
• Focus-based
• Swipe left:
• FOCUS moves left
• CONTENT moves right
FOCUS ENGINE
• Your app CAN:
• Specify what views can become focused
• Can request a focus update
• Provide a visual indication of focus
• Can coordinate any focus-related animation
• Your app CANNOT directly control focus
FOCUS-ABLE CLASSES
• UIButton
• UIControl
• UISegmentedControl
• UITabBar
• UITextField
• UISearchBar
• Cells
• UICollectionViewCell
• UITableViewCell
• Can be disabled via
delegate
UIView Focus Details
• Custom UIView subclasses can override
canBecomeFocused()
• Can check focused state with .focused
property
• Sample code to demonstrate this:
• https://github.com/ehyche/TVOSFocusExa
mple
UIFocusEnvironment
• Implemented by:
• UIView
• UIViewController
• UIWindow
• UIPresentationController
SETTING INITIAL FOCUS
DEBUGGING FOCUS
ISSUES
• Undocumented UIView method:
• _whyIsThisViewNotFocusable
• Gives you the reason the focus engine did
not focus on a particular view
• Quick Look on UIFocusUpdateContext
TV SERVICES EXTENSION
• Can provide static Top-Shelf Image
• If you want dynamic top-shelf data, then you
need a TV Services extension
• Sample TV Services Extension code:
• https://github.com/ehyche/FlickrTV
RESOURCES
• Apple Documentation
• Useful Blogs
• Other Resources
APPLE DOCS
• Human Interface Guidelines
(https://developer.apple.com/tvos/human-interface-guidelines/)
• App Programming Guide for tvOS
(https://developer.apple.com/library/prerelease/tvos/documentati
on/General/Conceptual/AppleTV_PG/)
• tvOS Developer Library
(https://developer.apple.com/library/tvos/navigation/)
• Framework References
• API Diffs
APPLE RESOURCES
• Sample Code
(https://developer.apple.com/library/tvos/navigation/#secti
on=Resource%20Types&topic=Sample%20Code)
• Downloads (https://developer.apple.com/tvos/download/)
• Parallax Previewer Mac OSX app
• Parallax Exporter Photoshop Plugin
• Photoshop Icon and Image Templates
USEFUL BLOGS
• AppleTV Weekly (appletvweekly.com)
• Erica Sadun’s Blog (ericasadun.com)
• Daniel Pasco’s Black Pixel Blog
(https://blackpixel.com/writing/)
OTHER RESOURCES
• Slack Group for Apple TV
(appletv.slack.com)
• Keynote template for prototyping apps
(https://medium.com/@itsleesimpson/appletv
-app-design-template-for-keynote-
90cac633cd92#.p7zvheak8)
• Tutorials (tutsplus.com, raywenderlich.com)
QUESTIONS?
ehyche@groupon.com

tvOS: An Introduction for iOS Developers

  • 1.
    TVOS An Introduction foriOS Developers Eric Hyche, Mobile API Tech Lead Groupon Consumer iOS Team
  • 2.
    DOCKET • Demo ofhardware • Types of apps • Drill-down on Focus Engine • Build a FlickrTV app • Resources • Q&A
  • 3.
    THE HARDWARE • 64-bitA8 processor • 32GB or 64GB storage • 2GB RAM • 1080p resolution • Siri Remote
  • 4.
    SIRI REMOTE 1. Glasstouch screen 2. Menu (back) 3. Siri/Search 4. Play/Pause 5. Home 6. Volume 7. Lightning Charging
  • 5.
  • 6.
  • 7.
  • 8.
    PARALLAX IMAGES • Madeup of layered images • Can produce them with: • Xcode • Parallax Previewer App • Photoshop plugin
  • 9.
    LIMITATIONS • Max sizeof app bundle is 200MB. If greater, must use On-Demand Resources • Limited persistent storage • 500KB • Accessed through NSUserDefaults • Persistent storage > 500KB • For < 1MB, use iCloud Key-Value Storage • For > 1MB, use CloudKit • Must implement your own user accounts, since device has only one iCloud account • No UIWebView
  • 10.
    LIMITATIONS • Apps haveto be submitted as BitCode binaries • This includes embedded frameworks • Most closed-source 3rd party frameworks won’t be usable on tvOS
  • 11.
    THE GOOD NEWS •Can usually assume high-bandwidth, low- latency networks • Screen size always the same (1080p) • Don’t have to worry about rotation, size class changes
  • 12.
    TYPES OF APPS •Games • DemoBots Sample (https://developer.apple.com/library/tvos/samplecode/DemoBots/I ntroduction/Intro.html#//apple_ref/doc/uid/TP40015179) • TVML-based apps • TVMLCatalog Sample (https://developer.apple.com/library/tvos/samplecode/TVMLCatalo g/Introduction/Intro.html#//apple_ref/doc/uid/TP40016505) • UIKit-based apps
  • 13.
    TVML-BASED APPS • TVApplicationController iscreated in App Delegate • Attached to key UIWindow and UIApplicationDelegate • Everything else handled by accessing Javascript and TVML
  • 14.
    UIKIT-BASED APPS • Mostof tvOS is a subset of iOS • Most ideas from UIKit translate directly • Check the iOS/tvOS API diffs in Release Notes • https://developer.apple.com/library/tvos/rel easenotes/General/tvOS90APIDiffs/index.h tml
  • 15.
    INDIRECT VS DIRECT •Direct Interaction (iPhone, iPad, etc) • Swipe left, content moves left • Indirect Interaction (tvOS) • Focus-based • Swipe left: • FOCUS moves left • CONTENT moves right
  • 16.
    FOCUS ENGINE • Yourapp CAN: • Specify what views can become focused • Can request a focus update • Provide a visual indication of focus • Can coordinate any focus-related animation • Your app CANNOT directly control focus
  • 17.
    FOCUS-ABLE CLASSES • UIButton •UIControl • UISegmentedControl • UITabBar • UITextField • UISearchBar • Cells • UICollectionViewCell • UITableViewCell • Can be disabled via delegate
  • 18.
    UIView Focus Details •Custom UIView subclasses can override canBecomeFocused() • Can check focused state with .focused property • Sample code to demonstrate this: • https://github.com/ehyche/TVOSFocusExa mple
  • 19.
    UIFocusEnvironment • Implemented by: •UIView • UIViewController • UIWindow • UIPresentationController
  • 20.
  • 21.
    DEBUGGING FOCUS ISSUES • UndocumentedUIView method: • _whyIsThisViewNotFocusable • Gives you the reason the focus engine did not focus on a particular view • Quick Look on UIFocusUpdateContext
  • 22.
    TV SERVICES EXTENSION •Can provide static Top-Shelf Image • If you want dynamic top-shelf data, then you need a TV Services extension • Sample TV Services Extension code: • https://github.com/ehyche/FlickrTV
  • 23.
    RESOURCES • Apple Documentation •Useful Blogs • Other Resources
  • 24.
    APPLE DOCS • HumanInterface Guidelines (https://developer.apple.com/tvos/human-interface-guidelines/) • App Programming Guide for tvOS (https://developer.apple.com/library/prerelease/tvos/documentati on/General/Conceptual/AppleTV_PG/) • tvOS Developer Library (https://developer.apple.com/library/tvos/navigation/) • Framework References • API Diffs
  • 25.
    APPLE RESOURCES • SampleCode (https://developer.apple.com/library/tvos/navigation/#secti on=Resource%20Types&topic=Sample%20Code) • Downloads (https://developer.apple.com/tvos/download/) • Parallax Previewer Mac OSX app • Parallax Exporter Photoshop Plugin • Photoshop Icon and Image Templates
  • 26.
    USEFUL BLOGS • AppleTVWeekly (appletvweekly.com) • Erica Sadun’s Blog (ericasadun.com) • Daniel Pasco’s Black Pixel Blog (https://blackpixel.com/writing/)
  • 27.
    OTHER RESOURCES • SlackGroup for Apple TV (appletv.slack.com) • Keynote template for prototyping apps (https://medium.com/@itsleesimpson/appletv -app-design-template-for-keynote- 90cac633cd92#.p7zvheak8) • Tutorials (tutsplus.com, raywenderlich.com)
  • 28.