Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Homekit on tvOS
Search
Shingo Tamaki
June 05, 2017
Technology
0
1.3k
Homekit on tvOS
HomeKit frameworkを使ったtvOSアプリ開発を通して学んだ事を簡単にまとめました。
Shingo Tamaki
June 05, 2017
Tweet
Share
More Decks by Shingo Tamaki
See All by Shingo Tamaki
沖縄モバイルアプリ開発勉強会#1
tamaki
0
82
iOSアプリ開発を始めよう
tamaki
0
120
詳解xcresult.pdf
tamaki
0
300
メルペイでのリグレッションテスト自動化推進のこれまでとこれから
tamaki
0
680
What do you want to test with UI Test v2
tamaki
2
840
JPQRによって変わる日本のQRコード決済
tamaki
0
240
What's New in Testing
tamaki
1
58
What do you want to test with UI Test
tamaki
5
1.8k
How to control state in UI Test
tamaki
4
2.5k
Other Decks in Technology
See All in Technology
TypeScript、上達の瞬間
sadnessojisan
46
13k
ノーコードデータ分析ツールで体験する時系列データ分析超入門
negi111111
0
420
CysharpのOSS群から見るModern C#の現在地
neuecc
2
3.5k
複雑なState管理からの脱却
sansantech
PRO
1
150
マルチプロダクトな開発組織で 「開発生産性」に向き合うために試みたこと / Improving Multi-Product Dev Productivity
sugamasao
1
310
AGIについてChatGPTに聞いてみた
blueb
0
130
OCI Security サービス 概要
oracle4engineer
PRO
0
6.5k
適材適所の技術選定 〜GraphQL・REST API・tRPC〜 / Optimal Technology Selection
kakehashi
1
690
オープンソースAIとは何か? --「オープンソースAIの定義 v1.0」詳細解説
shujisado
10
1.1k
OCI Network Firewall 概要
oracle4engineer
PRO
0
4.2k
SRE×AIOpsを始めよう!GuardDutyによるお手軽脅威検出
amixedcolor
0
170
誰も全体を知らない ~ ロールの垣根を超えて引き上げる開発生産性 / Boosting Development Productivity Across Roles
kakehashi
1
230
Featured
See All Featured
Code Reviewing Like a Champion
maltzj
520
39k
Making Projects Easy
brettharned
115
5.9k
Writing Fast Ruby
sferik
627
61k
GitHub's CSS Performance
jonrohan
1030
460k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
Automating Front-end Workflow
addyosmani
1366
200k
Keith and Marios Guide to Fast Websites
keithpitt
409
22k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
RailsConf 2023
tenderlove
29
900
Fashionably flexible responsive web design (full day workshop)
malarkey
405
65k
10 Git Anti Patterns You Should be Aware of
lemiorhan
655
59k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
Transcript
HomeKit on tvOS
ࣗݾհ
ࣗݾհ ۄ৴ޛ iOS Engineer! tvOSΞϓϦͷ։ൃࠓ͜ͷͷͨΊʹษڧ͠·ͨ͠ɻ झຯ" ిࢠ࡞⚡ ےτϨ$ ΨδΣοτ%
tvOSΞϓϦͷ։ൃํ๏ʹ͍ͭͯ • ΫϥΠΞϯτ/αʔόܕͷΞϓϦέʔγϣϯ (TVML Kit)
tvOSΞϓϦͷ։ൃํ๏ʹ͍ͭͯ • ωΠςΟϒ։ൃ
OrigamiͷtvOSΞϓϦ ΫϥΠΞϯτ/αʔόܕͰߏங͓ͯ͠ΓɺOrigamiͷECͷӾ ཡػೳΛఏڙ͍ͯ͠·͢ɻ
OrigamiͷtvOSΞϓϦ • TVMLͷTemplate͕ECͷίϯςϯπͱϚονͨ͠ • ϥΠϒΞοϓσʔτՄೳͰϦϦʔεͷख͕ؒগͳ͍ • ৽͍͠ϓϥοτϑΥʔϜͷνϟϨϯδ
ͰࠓωΠςΟϒ࣮ ʹؔ࿈ͨ͠Λ͠·͢ ! ͖ͳࣄ͍͍ͯͬͯ͠ݴΘΕͨ͠
ૣtvOSͷΛ ͢Δલʹ...
࠷ۙͷεϚʔτϗʔϜؔ࿈ͷ Alexa
࠷ۙͷεϚʔτϗʔϜؔ࿈ͷ Google Home
࠷ۙͷεϚʔτϗʔϜؔ࿈ͷ SiriεϐʔΧʔʁ
ͳͥ͜ͷΛ͔ͨ͠ͱ ͍͏ͱʁ
HomeKit
HomeKitͱʁ Apple͕ఏڙ͢ΔεϚʔτϗʔϜͷͨΊͷϑϨʔϜϫʔΫɺ HomeKitରԠΛൢച͢ΔʹMFiೝূ͕ඞཁ
AppleTVͷHomeKitʹ͓͚Δׂ • Remote Gateway ϦϞʔτίϯτϩʔϧɺΦʔτϝʔγϣϯ͕ՄೳՄೳ
iOS10 HomeΞϓϦ͕ొ
tvOSʁ
tvOS10 HomeKitରԠ
tvOS10ͷHomeKitରԠͰԿ͕ग़དྷΔ ͷ͔ʁ • HomeKit frameworkͷҰ෦ػೳ͕Մೳʹͳͬͨ • HomeΞϓϦtvOSʹଘࡏ͠ͳ͍
ͳͷͰHomeΞϓϦͲ ͖Λࢼ࡞ग़དྷͳ͍͔ͬ ͯΈͨ
DEMO
tvOSΞϓϦ։ൃͷಛ • ը໘αΠζ • ੍ݶ͞ΕͨετϨʔδ • ύϥϥοΫεΞΠίϯ • ϑΥʔΧε
tvOSΞϓϦ։ൃͷಛ • ը໘αΠζ • ੍ݶ͞ΕͨετϨʔδ • ύϥϥοΫεΞΠίϯ • ϑΥʔΧε ←
!
ϑΥʔΧεΤϯδϯ
tvOSΞϓϦͷ։ൃʹ͍ͭͯ ϑΥʔΧεͱ͍͏֓೦tvOSʹ͔͠ͳ͍ͷͰɺ tvOSΞϓϦ։ൃͷ࠷େͷצॴͰͳ͍͔ͱࢥ͍ͬͯ·͢ɻ αϯϓϧίʔυΛ࡞ͨ࣌͠ʹࢥ͍௨Γʹಈ͔ͳ͔ͬͨέʔε ͱɺͦͷରԠʹ͍ͭͯઆ໌͠·͢ɻ ※ ϫʔΫΞϥϯυͳײ͢͡ΔͷͰͬͱςΫχΧϧͳํ๏ ͕͋Ε୭͔͋ͱͰڭ͍͑ͯͩ͘͞ɻ
ͦͷ1
ࢥ͍௨ΓʹϑΥʔΧεग़དྷͳ͍ ͦͷ1
ࢥ͍௨ΓʹϑΥʔΧεग़དྷͳ͍ ͦͷ1
ࢥ͍௨ΓʹϑΥʔΧεग़དྷͳ͍ ͦͷ1 λϒόʔ͔ΒӈଆͷηϧͷϑΥʔΧεΛېࢭ͢Δ override func shouldUpdateFocus(in context: UIFocusUpdateContext) -> Bool
{ if let prev = context.previouslyFocusedView, String(describing:type(of: prev)) == "UITabBarButton" { return false } return true }
ͦͷ2
ࢥ͍௨ΓʹϑΥʔΧεग़དྷͳ͍ ͦͷ2
ࢥ͍௨ΓʹϑΥʔΧεग़དྷͳ͍ ͦͷ2
UIFocusEnvironment Protocol UIFocusEnvironment ProtocolͷσϦήʔτϝιουͰϑΥʔΧ εΛ͏·͘ίϯτϩʔϧग़དྷΔΑ͏ʹ ࣮͢Δඞཁ͕͋Δɻ var preferredFocusEnvironments: [UIFocusEnvironment] func
shouldUpdateFocus(in context: UIFocusUpdateContext) -> Bool { return ఆॲཧ݁Ռ } override func didUpdateFocus(in context: UIFocusUpdateContext, with coordinator: UIFocusAnimationCoordinator) { //ϑΥʔΧε࣌ʹߦ͍͍ͨॲཧ } https://developer.apple.com/reference/uikit/ uifocusenvironment
Debug Quick Look
Debug _whyIsThisViewNotFocusable σόοά࣌ʹ_whyIsThisViewNotFocusableϝιουΛݺͿ͜ ͱͰݪҼͱߟ͑ΒΕΔࣄ߲Λग़ྗͯ͘͠Ε·͢ɻ
Θ͔ͬͨࣄ શͯͷϝιου͕͑ΔΘ͚Ͱͳ͍ addHome(withName homeName: String, completionHandler completion: @escaping (HMHome?, Error?)
-> Void) removeHome(_ home: HMHome, completionHandler completion: @escaping (Error?) -> Void) updatePrimaryHome(HMHome, completionHandler: (Error?) -> Void) Homeͷ࡞ʹݶΒͣɺRoomΞΫηαϦʹ͍ͭͯಉ༷
Θ͔ͬͨࣄ શͯͷϝιου͕͑ΔΘ͚Ͱͳ͍ • ߟ • TVجຊతʹݟΔ͚ͩͰɺૢ࡞͠ͳ͍ࣄ͕ଟ͍(ϦϞί ϯͷૢ࡞ͩΔ͍...)ͨΊɺͦͷػೳ͕আ֎͞Ε͍ͯΔͷͰ !
͓·͚
͋ͳ͕ͨtvOSΞϓϦ ͷ։ൃΛ͢ΔͷͳΒ ग़ઌͰͷ࣮ػσόοάͭΒ͍
͋ͳ͕ͨtvOSΞϓϦͷ։ൃΛ͢Δͷͳ Β
͋ͳ͕ͨtvOSΞϓϦͷ։ൃΛ͢Δͷͳ Β • ࣮ػ(AppleTV)ܞଳੑʹ͍͠ͷͰɺHomeKitͷૢ࡞෦ ͷ։ൃiPhoneͰߦ͑ΔΑ͏ʹͯͨ͠ํ͕ग़ઌͰ։ൃ͠ ͍͢ɻ
γϛϡϨʔλͰྑ͍ͷͰ ʁ!
HomeKitͷDBڞ༗ʹ͍ͭͯ HomeKitͷiCloudʹΑΔDBڞ༗ γϛϡϨʔλͰग़དྷͳ͍
͓Θ͔Γ͍͚ͨͩͨͩΖ ͏͔!?
࣮ػ։ൃΛڧ͍ΒΕΔཧ༝ • HomeKit DBڞ༗࣮ػ͚ͩ • HomeKit FrameworkͰHome/Room/AccesoryͳͲͷ৽ن ొɾআɾฤू͕ग़དྷͳ͍ • ඞવతʹσʔλiCloudܦ༝ͷHomeKit
DBڞ༗པΈͱͳ Δ
Enjoy tvOS App Development
ࢀߟจݙ tvOSΞϓϦέʔγϣϯϓϩάϥϛϯάΨΠυ https://developer.apple.com/jp/documentation/General/ Conceptual/AppleTV_PG/ 2017ͦ͜tvOSΞϓϦ։ൃΛ࢝Ί͍ͨΤϯδχΞ͚ɺUI࣮ ϊϋू https://techblog.yahoo.co.jp/advent-calendar-2016/tvosapp- tips/
ࢀߟจݙ Apple TV – tvOSೖ – https://developers.cyberagent.co.jp/blog/archives/3642/ UIKitCatalogͷαϯϓϧίʔυ͔ΒtvOSͷϑΥʔΧεΛֶͿ http://qiita.com/hanawat/items/a2542df65e0534979cb0 ϚωʔϑΥϫʔυͷtvOSΞϓϦέʔγϣϯΛ։ൃͨ͠
https://moneyforward.com/engineers_blog/2016/02/26/ moneyforward-tvos/
Ҏ্