tvOS: An Introduction for iOS Developers

28
TVOS An Introduction for iOS Developers Eric Hyche, Mobile API Tech Lead Groupon Consumer iOS Team

Transcript of tvOS: An Introduction for iOS Developers

TVosAn Introduction for iOS DevelopersEric Hyche, Mobile API Tech LeadGroupon Consumer iOS Team

docketDemo of hardwareTypes of appsDrill-down on Focus EngineBuild a FlickrTV appResourcesQ&A

the hardware64-bit A8 processor32GB or 64GB storage2GB RAM1080p resolutionSiri Remote

siri remoteGlass touch screenMenu (back)Siri/SearchPlay/PauseHomeVolumeLightning Charging

siri remoteSwipeTapClick

siri remoteSwipeTapClick

siri remoteSwipeTapClick

parallax imagesMade up of layered imagesCan produce them with:XcodeParallax Previewer AppPhotoshop plugin

LimitationsMax size of app bundle is 200MB. If greater, must use On-Demand ResourcesLimited persistent storage500KBAccessed through NSUserDefaultsPersistent storage > 500KBFor < 1MB, use iCloud Key-Value StorageFor > 1MB, use CloudKitMust implement your own user accounts, since device has only one iCloud accountNo UIWebView

LimitationsApps have to be submitted as BitCode binariesThis includes embedded frameworksMost closed-source 3rd party frameworks wont be usable on tvOS

the good newsCan usually assume high-bandwidth, low-latency networksScreen size always the same (1080p)Dont have to worry about rotation, size class changes

types of appsGamesDemoBots Sample (https://developer.apple.com/library/tvos/samplecode/DemoBots/Introduction/Intro.html#//apple_ref/doc/uid/TP40015179)TVML-based appsTVMLCatalog Sample (https://developer.apple.com/library/tvos/samplecode/TVMLCatalog/Introduction/Intro.html#//apple_ref/doc/uid/TP40016505)UIKit-based apps

tvml-based appsTVApplicationController is created in App DelegateAttached to key UIWindow and UIApplicationDelegateEverything else handled by accessing Javascript and TVML

UIkit-based appsMost of tvOS is a subset of iOSMost ideas from UIKit translate directlyCheck the iOS/tvOS API diffs in Release Noteshttps://developer.apple.com/library/tvos/releasenotes/General/tvOS90APIDiffs/index.html

indirect vs directDirect Interaction (iPhone, iPad, etc)Swipe left, content moves leftIndirect Interaction (tvOS)Focus-basedSwipe left:FOCUS moves leftCONTENT moves right

focus engineYour app CAN:Specify what views can become focusedCan request a focus updateProvide a visual indication of focusCan coordinate any focus-related animationYour app CANNOT directly control focus

focus-able classesUIButtonUIControlUISegmentedControlUITabBarUITextFieldUISearchBarCellsUICollectionViewCellUITableViewCellCan be disabled via delegate

UIView Focus DetailsCustom UIView subclasses can override canBecomeFocused()Can check focused state with .focused propertySample code to demonstrate this:https://github.com/ehyche/TVOSFocusExample

UIFocusEnvironmentImplemented by:UIViewUIViewControllerUIWindowUIPresentationController

setting initial focus

debugging Focus issuesUndocumented UIView method:_whyIsThisViewNotFocusableGives you the reason the focus engine did not focus on a particular viewQuick Look on UIFocusUpdateContext

tv services extensionCan provide static Top-Shelf ImageIf you want dynamic top-shelf data, then you need a TV Services extensionSample TV Services Extension code:https://github.com/ehyche/FlickrTV

resourcesApple DocumentationUseful BlogsOther Resources

Apple docsHuman Interface Guidelines (https://developer.apple.com/tvos/human-interface-guidelines/)App Programming Guide for tvOS (https://developer.apple.com/library/prerelease/tvos/documentation/General/Conceptual/AppleTV_PG/)tvOS Developer Library (https://developer.apple.com/library/tvos/navigation/)Framework ReferencesAPI Diffs

apple resourcesSample Code (https://developer.apple.com/library/tvos/navigation/#section=Resource%20Types&topic=Sample%20Code)Downloads (https://developer.apple.com/tvos/download/)Parallax Previewer Mac OSX appParallax Exporter Photoshop PluginPhotoshop Icon and Image Templates

useful blogsAppleTV Weekly (appletvweekly.com)Erica Saduns Blog (ericasadun.com)Daniel Pascos Black Pixel Blog (https://blackpixel.com/writing/)

Other resourcesSlack 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)

[email protected]