Slide 1

Slide 1 text

HomeKit on tvOS

Slide 2

Slide 2 text

ࣗݾ঺հ

Slide 3

Slide 3 text

ࣗݾ঺հ ۄ৓৴ޛ iOS Engineer! tvOSΞϓϦͷ։ൃ͸ࠓ೔͜ͷ೔ͷͨΊʹษڧ͠·ͨ͠ɻ झຯ" ిࢠ޻࡞⚡ ےτϨ$ ΨδΣοτ%

Slide 4

Slide 4 text

tvOSΞϓϦͷ։ൃํ๏ʹ͍ͭͯ • ΫϥΠΞϯτ/αʔόܕͷΞϓϦέʔγϣϯ (TVML Kit)

Slide 5

Slide 5 text

tvOSΞϓϦͷ։ൃํ๏ʹ͍ͭͯ • ωΠςΟϒ։ൃ

Slide 6

Slide 6 text

OrigamiͷtvOSΞϓϦ ΫϥΠΞϯτ/αʔόܕͰߏங͓ͯ͠ΓɺOrigamiͷECͷ঎඼Ӿ ཡػೳΛఏڙ͍ͯ͠·͢ɻ

Slide 7

Slide 7 text

OrigamiͷtvOSΞϓϦ • TVMLͷTemplate͕ECͷίϯςϯπͱϚονͨ͠ • ϥΠϒΞοϓσʔτՄೳͰϦϦʔεͷख͕ؒগͳ͍ • ৽͍͠ϓϥοτϑΥʔϜ΁ͷνϟϨϯδ

Slide 8

Slide 8 text

Ͱ΋ࠓ೔͸ωΠςΟϒ࣮ ૷ʹؔ࿈ͨ͠࿩Λ͠·͢ ! ޷͖ͳࣄ࿩͍͍ͯͬͯ͠ݴΘΕͨ͠

Slide 9

Slide 9 text

ૣ଎tvOSͷ࿩Λ ͢Δલʹ...

Slide 10

Slide 10 text

࠷ۙͷεϚʔτϗʔϜؔ࿈ͷ࿩୊ Alexa

Slide 11

Slide 11 text

࠷ۙͷεϚʔτϗʔϜؔ࿈ͷ࿩୊ Google Home

Slide 12

Slide 12 text

࠷ۙͷεϚʔτϗʔϜؔ࿈ͷ࿩୊ SiriεϐʔΧʔʁ

Slide 13

Slide 13 text

ͳͥ͜ͷ࿩୊Λ͔ͨ͠ͱ ͍͏ͱʁ

Slide 14

Slide 14 text

HomeKit

Slide 15

Slide 15 text

HomeKitͱ͸ʁ Apple͕ఏڙ͢ΔεϚʔτϗʔϜͷͨΊͷϑϨʔϜϫʔΫɺ HomeKitରԠ୺຤Λൢച͢Δʹ͸MFiೝূ͕ඞཁ

Slide 16

Slide 16 text

AppleTVͷHomeKitʹ͓͚Δ໾ׂ • Remote Gateway ϦϞʔτίϯτϩʔϧɺΦʔτϝʔγϣϯ͕ՄೳՄೳ

Slide 17

Slide 17 text

iOS10 HomeΞϓϦ͕ొ৔

Slide 18

Slide 18 text

tvOS͸ʁ

Slide 19

Slide 19 text

tvOS10 HomeKitରԠ

Slide 20

Slide 20 text

tvOS10ͷHomeKitରԠͰԿ͕ग़དྷΔ ͷ͔ʁ • HomeKit frameworkͷҰ෦ػೳ͕Մೳʹͳͬͨ • HomeΞϓϦ͸tvOSʹ͸ଘࡏ͠ͳ͍

Slide 21

Slide 21 text

ͳͷͰHomeΞϓϦ΋Ͳ ͖Λࢼ࡞ग़དྷͳ͍͔΍ͬ ͯΈͨ

Slide 22

Slide 22 text

DEMO

Slide 23

Slide 23 text

tvOSΞϓϦ։ൃͷಛ௃ • ը໘αΠζ • ੍ݶ͞ΕͨετϨʔδ • ύϥϥοΫεΞΠίϯ • ϑΥʔΧε

Slide 24

Slide 24 text

tvOSΞϓϦ։ൃͷಛ௃ • ը໘αΠζ • ੍ݶ͞ΕͨετϨʔδ • ύϥϥοΫεΞΠίϯ • ϑΥʔΧε ← !

Slide 25

Slide 25 text

ϑΥʔΧεΤϯδϯ

Slide 26

Slide 26 text

tvOSΞϓϦͷ։ൃʹ͍ͭͯ ϑΥʔΧεͱ͍͏֓೦͸tvOSʹ͔͠ͳ͍΋ͷͰɺ tvOSΞϓϦ։ൃͷ࠷େͷצॴͰ͸ͳ͍͔ͱࢥ͍ͬͯ·͢ɻ αϯϓϧίʔυΛ࡞੒ͨ࣌͠ʹࢥ͍௨Γʹಈ͔ͳ͔ͬͨέʔε ͱɺͦͷରԠʹ͍ͭͯઆ໌͠·͢ɻ ※ ϫʔΫΞϥ΢ϯυͳײ͡΋͢ΔͷͰ΋ͬͱςΫχΧϧͳํ๏ ͕͋Ε͹୭͔͋ͱͰڭ͍͑ͯͩ͘͞ɻ

Slide 27

Slide 27 text

ͦͷ1

Slide 28

Slide 28 text

ࢥ͍௨ΓʹϑΥʔΧεग़དྷͳ͍ ͦͷ1

Slide 29

Slide 29 text

ࢥ͍௨ΓʹϑΥʔΧεग़དྷͳ͍ ͦͷ1

Slide 30

Slide 30 text

ࢥ͍௨ΓʹϑΥʔΧεग़དྷͳ͍ ͦͷ1 λϒόʔ͔Βӈଆͷηϧ΁ͷϑΥʔΧεΛېࢭ͢Δ override func shouldUpdateFocus(in context: UIFocusUpdateContext) -> Bool { if let prev = context.previouslyFocusedView, String(describing:type(of: prev)) == "UITabBarButton" { return false } return true }

Slide 31

Slide 31 text

ͦͷ2

Slide 32

Slide 32 text

ࢥ͍௨ΓʹϑΥʔΧεग़དྷͳ͍ ͦͷ2

Slide 33

Slide 33 text

ࢥ͍௨ΓʹϑΥʔΧεग़དྷͳ͍ ͦͷ2

Slide 34

Slide 34 text

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

Slide 35

Slide 35 text

Debug Quick Look

Slide 36

Slide 36 text

Debug _whyIsThisViewNotFocusable σόοά࣌ʹ_whyIsThisViewNotFocusableϝιουΛݺͿ͜ ͱͰݪҼͱߟ͑ΒΕΔࣄ߲Λग़ྗͯ͘͠Ε·͢ɻ

Slide 37

Slide 37 text

Θ͔ͬͨࣄ શͯͷϝιου͕࢖͑ΔΘ͚Ͱ͸ͳ͍ 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΍ΞΫηαϦʹ͍ͭͯ΋ಉ༷

Slide 38

Slide 38 text

Θ͔ͬͨࣄ શͯͷϝιου͕࢖͑ΔΘ͚Ͱ͸ͳ͍ • ߟ࡯ • TV͸جຊతʹݟΔ͚ͩͰɺૢ࡞͸͠ͳ͍ࣄ͕ଟ͍(ϦϞί ϯͷૢ࡞͸ͩΔ͍...)ͨΊɺͦͷػೳ͕আ֎͞Ε͍ͯΔͷͰ ͸!

Slide 39

Slide 39 text

͓·͚

Slide 40

Slide 40 text

͋ͳ͕ͨtvOSΞϓϦ ͷ։ൃΛ͢ΔͷͳΒ ग़ઌͰͷ࣮ػσόοάͭΒ͍

Slide 41

Slide 41 text

͋ͳ͕ͨtvOSΞϓϦͷ։ൃΛ͢Δͷͳ Β

Slide 42

Slide 42 text

͋ͳ͕ͨtvOSΞϓϦͷ։ൃΛ͢Δͷͳ Β • ࣮ػ(AppleTV)͸ܞଳੑʹ๡͍͠ͷͰɺHomeKitͷૢ࡞෦෼ ͷ։ൃ͸iPhoneͰ΋ߦ͑ΔΑ͏ʹͯͨ͠ํ͕ग़ઌͰ։ൃ͠΍ ͍͢ɻ

Slide 43

Slide 43 text

γϛϡϨʔλͰྑ͍ͷͰ ͸ʁ!

Slide 44

Slide 44 text

HomeKitͷDBڞ༗ʹ͍ͭͯ HomeKitͷiCloudʹΑΔDBڞ༗͸ γϛϡϨʔλͰ͸ग़དྷͳ͍

Slide 45

Slide 45 text

͓Θ͔Γ͍͚ͨͩͨͩΖ ͏͔!?

Slide 46

Slide 46 text

࣮ػ։ൃΛڧ͍ΒΕΔཧ༝ • HomeKit DBڞ༗͸࣮ػ͚ͩ • HomeKit FrameworkͰ͸Home/Room/AccesoryͳͲͷ৽ن ొ࿥ɾ࡟আɾฤू͕ग़དྷͳ͍ • ඞવతʹσʔλ͸iCloudܦ༝ͷHomeKit DBڞ༗པΈͱͳ Δ

Slide 47

Slide 47 text

Enjoy tvOS App Development

Slide 48

Slide 48 text

ࢀߟจݙ tvOSΞϓϦέʔγϣϯϓϩάϥϛϯάΨΠυ https://developer.apple.com/jp/documentation/General/ Conceptual/AppleTV_PG/ 2017೥ͦ͜tvOSΞϓϦ։ൃΛ࢝Ί͍ͨΤϯδχΞ޲͚ɺUI࣮૷ ϊ΢ϋ΢ू https://techblog.yahoo.co.jp/advent-calendar-2016/tvosapp- tips/

Slide 49

Slide 49 text

ࢀߟจݙ 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/

Slide 50

Slide 50 text

Ҏ্