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
820
Profiling using Signpost
toshi0383
2
1.1k
AVPlayer周りの設計tips
toshi0383
6
940
cmdshelf::from("Swift")
toshi0383
3
960
Other Decks in Programming
See All in Programming
AmebaブログはKMPから卒業します
kmars0605
0
170
npm との違いを手がかりにGo の依存管理を理解したい
optim
0
240
golang-bob.pdf
iwatsukayura
0
130
【加筆修正版】Laravel のアプリケーションをどこにデプロイするか #phpcon_ehime
akase244
0
150
Railsバージョンを4倍にした話
optim
0
320
phperだってパンチカードでコーディングしたい
o0h
PRO
0
330
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
170
The Rails Doctrine Decade
koic
2
580
自サークルのIdPからログアウトできるようになるまで
taiseiue
1
140
Unity6 URPによる海底をテーマにしたVJシステムの解説 | Unity Shader 完全に理解した 勉強会
gam0022
0
370
Domain-Driven Transformation
hschwentner
2
2.3k
3回つくってわかった、 定期実行ジョブ基盤の本質情報
takai
0
440
Featured
See All Featured
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
Automating Front-end Workflow
addyosmani
1369
210k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
280
GraphQLとの向き合い方2022年版
quramy
50
15k
AI: The stuff that nobody shows you
jnunemaker
PRO
10
1.2k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
How to make the Groovebox
asonas
2
2.5k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
320
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
5
820
Agile that works and the tools we love
rasmusluckow
331
22k
Ruling the World: When Life Gets Gamed
codingconduct
0
400
Making the Leap to Tech Lead
cromwellryan
135
10k
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