Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
tvOS App Development
Search
toshi0383
April 16, 2016
Programming
530
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
tvOS App Development
toshi0383
April 16, 2016
More Decks by toshi0383
See All by toshi0383
CoreDataはじめました
toshi0383
0
190
Swiftコードバトル必勝法
toshi0383
1
380
Sheets API使ってみた
toshi0383
2
430
visionOSについてGlobeeが取り組んでいること
toshi0383
0
620
agile20150512-150512055145-lva1-app6892.pdf
toshi0383
0
270
たのしいAirPlay
toshi0383
1
810
Profiling using Signpost
toshi0383
2
1.1k
AVPlayer周りの設計tips
toshi0383
6
940
cmdshelf::from("Swift")
toshi0383
3
950
Other Decks in Programming
See All in Programming
なぜCTOを降りてFDEを選んだのか?〜なぜプロダクト企業がFDEで顧客の現場に踏み込むのか〜
gonta
1
150
SalesForceを内製化!? ~ HR事業を支える顧客管理基盤のインフラを大公開 ~
oku053
0
130
UnityでSystem.Net.WebSocketsなWebSocketサーバが動かないのでUnity Monoのコードを覗いてみた / about implementing websocket server with unity mono
drumath2237
1
550
Webの地図
yosuke_furukawa
PRO
6
5.1k
IBM Bob Dojo #1 仕様駆動開発入門
oniak3ibm
PRO
0
350
iOSDC2026登壇資料.pdf
riofujimon
0
210
Simple Storage Service(S3) is not simple
iwatsukayura
0
210
モジュールの視点からSwiftを読み解く #iosdc
s_shimotori
0
350
Are APIs Still Relevant in the AI Era?
soyuka
0
420
AWS CDKのカスタムリソースでContinuum(旧Security Agent)を実装した話 | Implementing Continuum (formerly Security Agent) via AWS CDK Custom Resource
akihisaikeda
2
140
Workers Cache を知る
syumai
0
340
残高管理から台帳サービスへの進化
artoy
0
150
Featured
See All Featured
Being A Developer After 40
akosma
91
590k
Designing for Timeless Needs
cassininazir
1
520
Ten Tips & Tricks for a 🌱 transition
stuffmc
1
250
Skip the Path - Find Your Career Trail
mkilby
1
240
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
370
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
550
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
250
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.9k
Everyday Curiosity
cassininazir
0
340
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
3.3k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
460
Transcript
TVOS APP DEVELOPMENT APRIL 16, 2016 SAT. 1 — ©
Toshihiro Suzuki 2016
TOSHIHIRO SUZUKI > ླ ढ़༟ > @toshi0383 > iOS/Mac/tvOS develper
> currently at NEXTSCAPE 2 — © Toshihiro Suzuki 2016
TOSHIHIRO SUZUKI > Develops Apps and contribute to OSS >
Drives go-kart > Drummer > Snowboarder > try! Swift attendee 3 — © Toshihiro Suzuki 2016
TVOS IS A NEW PLATFORM WE CAN USE THE NEWEST
APIS 4 — © Toshihiro Suzuki 2016
TO TRY OUT NEW THINGS 5 — © Toshihiro Suzuki
2016
IS FUN. 6 — © Toshihiro Suzuki 2016
APPLETV 7 — © Toshihiro Suzuki 2016
HAS VERY UNIQUE USER INTERFACE. IT'S OUR NEW TOY !
8 — © Toshihiro Suzuki 2016
ALSO THERE IS 9 — © Toshihiro Suzuki 2016
NO SCREEN ROTATIONS 10 — © Toshihiro Suzuki 2016
WHICH IS GREAT. 11 — © Toshihiro Suzuki 2016
TODAY I WILL SHARE > our daily development and codebase.
> tvOS specific topics > Readability tips 12 — © Toshihiro Suzuki 2016
PROJECT ! 13 — © Toshihiro Suzuki 2016
THE APP > is kind of like Netflix. > Already
available on iOS/Android, AndroidTV, TVs > We're middle of development. We're not the owner of the service. 14 — © Toshihiro Suzuki 2016
DAILY DEVELOPMENT 15 — © Toshihiro Suzuki 2016
LIBRARY 16 — © Toshihiro Suzuki 2016
CARTHAGE $ cat Cartfile github "rs/SDWebImage" "master" github "toshi0383/TVMLKitchen" github
"cbpowell/MarqueeLabel-Swift" github "duemunk/Async" github "ReactiveX/RxSwift" github "ikesyo/Himotoki" github "ishkawa/APIKit" ~> 1.3 github "realm/realm-cocoa" github "radex/SwiftyUserDefaults" "master" github "malcommac/SwiftDate github "AliSoftware/OHHTTPStubs" I checkin Carthage/Build/tvOS to repo. ! git history data gets larger " Build is fast 17 — © Toshihiro Suzuki 2016
OTHER LIBRARIES > inamiy/DebugLog > Fabric (Crashlytics) > DRM Manager
SDK (Static Library written in C) 18 — © Toshihiro Suzuki 2016
SWIFTLINT FOR CODE FORMATTING 19 — © Toshihiro Suzuki 2016
SWIFTGEN FOR CODE GENERATING 20 — © Toshihiro Suzuki 2016
TESTING ! 21 — © Toshihiro Suzuki 2016
PLAIN XCTEST > runs on Bitrise on every git-push >
mostly tests for models > couple of async test > No UITests any more (we've quit) 22 — © Toshihiro Suzuki 2016
OHHTTPSTUBS 23 — © Toshihiro Suzuki 2016
TEST FAILS ❌ 24 — © Toshihiro Suzuki 2016
You might get unwanted assertionFailure() caused by server API response.
25 — © Toshihiro Suzuki 2016
SOLUTION /// Calls assertionFailure unless isRunningTests() is true /// This
is useful in such case like when /// unstable API causes UITests failure. (which happens like always...) /// - parameter msg: func assertionError(msg: String = "") { if !isRunningTests() { assertionFailure(msg) } } 26 — © Toshihiro Suzuki 2016
ISRUNNINGTESTS() /// Detects if app is running xctest /// -
returns: true if running xctest func isRunningTests() -> Bool { let env = NSProcessInfo.processInfo().environment - if let path = env["XCInjectBundle"] { // Xcode7.2 - return NSString(string: path).pathExtension == "xctest" - } + if let _ = env["XCTestConfigurationFilePath"] { // Xcode7.3 + return true + } if let _ = env["UITest"] { return true } return false } 27 — © Toshihiro Suzuki 2016
"UITEST" ENV VARIABLE /// HogeUITests.swift func setup() { ... let
app = XCUIApplication() app.launchEnvironment["UITest"] = "" 28 — © Toshihiro Suzuki 2016
BETA DISTRIBUTING ! 29 — © Toshihiro Suzuki 2016
30 — © Toshihiro Suzuki 2016
TVOS IS NOT SUPPORTED. 31 — © Toshihiro Suzuki 2016
32 — © Toshihiro Suzuki 2016
MAKEFILE TEST_DESTINATION=-destination "platform=tvOS Simulator,name=Apple TV 1080p,OS=latest" TEST=xcodebuild $(XCODEFLAGS) -scheme $(SCHEME)
clean test $(TEST_DESTINATION) .PHONY: test beta release archive clean ipa-beta ipa ship test: set -o pipefail $(TEST) 33 — © Toshihiro Suzuki 2016
MAKEFILE archive: ./script/check-xcode-version.sh if [ $? -ne 0 ];then exit
1;fi ./script/prepare_for_release.sh if [ ! -d $(BUILD_DIR)/script ];then mkdir -p $(BUILD_DIR)/script;fi xcodebuild -project $(PROJECT).xcodeproj -scheme $(SCHEME) \ -destination "generic/platform=tvOS" \ -xcconfig ./config/App-tvOS.xcconfig \ -archivePath $(ARCHIVE_PATH) \ PROVISIONING_PROFILE=$(PROVISIONING_PROFILE) \ -verbose \ archive | xcpretty --color ipa: xcodebuild -exportArchive -archivePath $(ARCHIVE_PATH) -exportPath $(BUILD_DIR) \ -exportOptionsPlist $(EXPORT_OPTION_PLIST) \ PROVISIONING_PROFILE=$(PROVISIONING_PROFILE) \ -destination "generic/platform=tvOS" 34 — © Toshihiro Suzuki 2016
35 — © Toshihiro Suzuki 2016
TVOS IS NOT SUPPORTED. 36 — © Toshihiro Suzuki 2016
GITHUB RELEASE PAGE fastlane ios upload ipa:$(IPA_PATH) My boss will
download this app and hand it to testers and customers. 37 — © Toshihiro Suzuki 2016
HOW TO INSTALL A BETA APP TO DEVICE You always
need a Xcode 38 — © Toshihiro Suzuki 2016
NOTE TVOS APPS CANNOT DISTRIBUTE USING ENTERPRISE PROVISIONING PROFILES 39
— © Toshihiro Suzuki 2016
TVOS SPECIFIC TOPICS > Focus Engine > TopShelf > TVML
> UITabBar << > UITableView << > AVPlayerViewController << 40 — © Toshihiro Suzuki 2016
UITABBAR <UITabBarController: 0x7fb3d5230c70> is trying to set 7 view controllers
when only 5 view controllers are supported on this platform. Any additional view controllers will not be shown. 41 — © Toshihiro Suzuki 2016
UITABLEVIEW 42 — © Toshihiro Suzuki 2016
AVPLAYERVIEWCONTROLLER 43 — © Toshihiro Suzuki 2016
READABILITY TIPS ! 44 — © Toshihiro Suzuki 2016
TIPS #1 USE SWIFTLINT It's good for your health. 45
— © Toshihiro Suzuki 2016
TIPS #2 Use typealias for important types typealias JSON =
[String: AnyObject] typealias ProductId = String typealias GenreId = String struct Product: Decodable { let productId: ProductId? let productQualityType: ProductQuality? 46 — © Toshihiro Suzuki 2016
TIPS #3 WRITE COMMENT, WRITE TESTS You will forget everything
in next week. I guarantee. 47 — © Toshihiro Suzuki 2016
TIPS #4 IT'S OKAY TO CODE IN YOUR LANGUAGE. enum
RequestSortType: Int { case ৽ணॱ = 1, ̑̌Իॱ = 3, ਓؾॱ = 4 } switch sortType { case .৽ணॱ: break case .̑̌Իॱ: break case .ਓؾॱ: break } 48 — © Toshihiro Suzuki 2016
TIPS #5 USE RXSWIFT WHERE NEEDED. func update(force: Bool) ->
Observable<Void> { return Observable.create { observer in guard force || needsUpdate(self, interval: Constants.APIBatchUpdateInterval) else { observer.onCompleted() return AnonymousDisposable{} } let task = self.updateChannel().bindTo(self.updateTitleList) .subscribeCompleted { observer.onCompleted() self.lastSuccessfulUpdate = NSDate() } return AnonymousDisposable{task.dispose()} } } 49 — © Toshihiro Suzuki 2016
WRAP UP I TALKED ABOUT > our daily development and
codebase. > tvOS specific topics > Readability tips 50 — © Toshihiro Suzuki 2016
AGAIN, TVOS IS A NEW PLATFORM. 51 — © Toshihiro
Suzuki 2016
IT'S BEEN GREAT EXPERIENCE TO BE PART OF THIS ECOSYSTEM.
52 — © Toshihiro Suzuki 2016
FEEL FREE TO ASK ME ANY QUESTIONS ABOUT TVOS. 53
— © Toshihiro Suzuki 2016
BTW, IF YOU WANT A TVML AND NATIVE HYBRID TVOS
APP I'VE HEARD OF TVMLKITCHEN. 54 — © Toshihiro Suzuki 2016
THANK YOU ! 55 — © Toshihiro Suzuki 2016