Slide 1

Slide 1 text

tvOSΞϓϦUIͷצॴ ॴ ༑ଠ / Yuta Tokoro, iOS & tvOS App Programmer #iOSDC Japan 2018 2018/08/31 16:50ʙ Track D ϨΪϡϥʔτʔΫʢ15෼ʣ

Slide 2

Slide 2 text

ॴ ༑ଠ / Yuta Tokoro @tokorom tokorom Spinners Inc.

Slide 3

Slide 3 text

࣭໰ • 1. tvOSͷΞϓϦΛ։ൃͨ͜͠ͱ͕͋Γ·͔͢ʁ • 2. iOSʢUIKitʣͷΞϓϦΛ։ൃͨ͜͠ͱ͕͋Γ·͔͢ʁ

Slide 4

Slide 4 text

Agenda • tvOSͱiOSΞϓϦͷҧ͍ • ϑΥʔΧεͷऔΓѻ͍ • ςϨϏͷϦϞίϯͷऔΓѻ͍ • TVUIKit • Password AutoFillʢ͕࣌ؒ༨ͬͨΒ͓·͚ͱͯ͠ʣ

Slide 5

Slide 5 text

tvOSͱiOSΞϓϦͷҧ͍

Slide 6

Slide 6 text

tvOSΞϓϦ͸ ؆୯ʹ࡞Ε·͔͢ʁ

Slide 7

Slide 7 text

࡞Ε·͢ɻ

Slide 8

Slide 8 text

iOSΞϓϦ͔ΒtvOSΞϓϦΛ࡞ͬͨྫ 30% 50% 20% ίʔυྔͷׂ߹ iOSઐ༻ tvOSઐ༻ ڞ௨෦෼ ※Swiftίʔυͷจࣈ਺

Slide 9

Slide 9 text

iOSΞϓϦ͔ΒtvOSΞϓϦΛ࡞ͬͨྫ 73% 27% ݩͷiOSίʔυͷ73%Λڞ༻ iOSઐ༻ ڞ௨෦෼

Slide 10

Slide 10 text

ͲͷลΓΛ௥Ճ։ൃʁ Model / Library View Controller View Storybord / xib

Slide 11

Slide 11 text

ͳͥ ڞ༻Ͱ͖Δʁ • tvOSΞϓϦͰ͸UIKit͕΄ͱΜͲͦͷ··࢖͑Δ • Foundation΍Core Graphics΋ͦͷ··࢖͑Δ • AVFoundation΍PhotoKitͳͲ΋࢖͑Δ

Slide 12

Slide 12 text

iOSΞϓϦ։ൃͱ ΄ͱΜͲಉ͡

Slide 13

Slide 13 text

Ͳ͕͜ҧ͏ʁ

Slide 14

Slide 14 text

tvOSΞϓϦͱiOSΞϓϦͷҧ͍ • iPhoneɺiPadͳͲݶΒΕͨը໘΁ͷදࣔͰͳ͘ɺࢢൢͷ ςϨϏʹΞϓϦΛදࣔ͢Δ • iOSΞϓϦͷΑ͏ʹը໘ΛλονͰ͖ͣɺϑΥʔΧεͱ ͍͏֓೦Λѻ͏ඞཁ͕͋Δ • ςϨϏͷϦϞίϯͰૢ࡞Ͱ͖Δඞཁ͕͋Δ

Slide 15

Slide 15 text

େ͖͘ҧ͏ͷ͸ User Interface

Slide 16

Slide 16 text

tvOSΞϓϦͱiOSΞϓϦͷҧ͍ • iPhoneɺiPadͳͲݶΒΕͨը໘΁ͷදࣔͰͳ͘ɺࢢൢͷ ςϨϏʹΞϓϦΛදࣔ͢Δ • iOSΞϓϦͷΑ͏ʹը໘ΛλονͰ͖ͣɺϑΥʔΧεͱ ͍͏֓೦Λѻ͏ඞཁ͕͋Δ • ςϨϏͷϦϞίϯͰૢ࡞Ͱ͖Δඞཁ͕͋Δ

Slide 17

Slide 17 text

Agenda ✓tvOSͱiOSΞϓϦͷҧ͍ • ϑΥʔΧεͷऔΓѻ͍ • ςϨϏͷϦϞίϯͷऔΓѻ͍ • TVUIKit • Password AutoFill

Slide 18

Slide 18 text

ϑΥʔΧε ͷऔΓѻ͍

Slide 19

Slide 19 text

ϑΥʔΧε͕ඞཁͳཧ༝

Slide 20

Slide 20 text

ϑΥʔΧε͕ඞཁͳཧ༝

Slide 21

Slide 21 text

ϑΥʔΧε͕ඞཁͳཧ༝

Slide 22

Slide 22 text

ϑΥʔΧεɾΫΠζ

Slide 23

Slide 23 text

ϑΥʔΧεɾΫΠζ 1

Slide 24

Slide 24 text

ϑΥʔΧεɾΫΠζ 1

Slide 25

Slide 25 text

ϑΥʔΧεɾΫΠζ 2

Slide 26

Slide 26 text

ϑΥʔΧεɾΫΠζ 2

Slide 27

Slide 27 text

ϑΥʔΧεɾΫΠζ 3

Slide 28

Slide 28 text

ϑΥʔΧεɾΫΠζ 3

Slide 29

Slide 29 text

ϑΥʔΧεɾΫΠζ 4

Slide 30

Slide 30 text

ϑΥʔΧεɾΫΠζ 4

Slide 31

Slide 31 text

ϑΥʔΧεɾΫΠζ ղઆ

Slide 32

Slide 32 text

ϑΥʔΧεɾΫΠζ ղઆ

Slide 33

Slide 33 text

ϑΥʔΧεɾΫΠζ ղઆ

Slide 34

Slide 34 text

ϑΥʔΧεɾΫΠζ ղઆ

Slide 35

Slide 35 text

ϑΥʔΧεͷऔΓѻ͍ Summary • ϑΥʔΧε͸tvOSಛ༗ͷ࠷ॏཁͷUI • ϑΥʔΧεʹؔ͢Δਖ਼͍͠஌ࣝΛಘΔ͜ͱ͕ɺྑ͍tvOS ΞϓϦΛ࡞Δۙಓ • جຊతʹ͸Apple७ਖ਼ΞϓϦͷUIͷڍಈʹ߹ΘͤΔ • ඪ४తͳUIΛ஌Δ͜ͱͰɺ͔ͦ͜Β׶͑ͯ֎͢બ୒͕Ͱ ͖ΔΑ͏ʹͳΔ

Slide 36

Slide 36 text

ςϨϏͷϦϞίϯ ͷऔΓѻ͍

Slide 37

Slide 37 text

Siri Remote

Slide 38

Slide 38 text

ςϨϏͷϦϞίϯ

Slide 39

Slide 39 text

ςϨϏͷϦϞίϯ

Slide 40

Slide 40 text

چܕApple TVͷRemote

Slide 41

Slide 41 text

ήʔϜίϯτϩʔϥ

Slide 42

Slide 42 text

ςϨϏͷϦϞίϯ

Slide 43

Slide 43 text

ςϨϏͷϦϞίϯͰಈ͘UIύʔπ • UIButton • UITextField • UITableView • UICollectionView • UIScrollViewʢϑΥʔΧεՄೳͳView͕ඞཁʣ • UIPageViewController • etc…

Slide 44

Slide 44 text

let leftArrow = UITapGestureRecognizer( target: self, action: #selector(leftArrowAction) ) leftArrow.allowedPressTypes = [ NSNumber(value: UIPressType.leftArrow.rawValue) ] view.addGestureRecognizer(leftArrow)

Slide 45

Slide 45 text

ςϨϏͷϦϞίϯͷ্Լࠨӈ • γϛϡϨʔλͰૢ࡞͢Δ৔߹͸ɺΩʔϘʔυͷ্Լࠨӈ Ωʔ • Siri RemoteͷλοναʔϑΣεͷ୺ͷλοϓͰ΋ಉ͡Π ϕϯτ͕ൃੜ

Slide 46

Slide 46 text

λοναʔϑΣε୺ͷޡλοϓ

Slide 47

Slide 47 text

ςϨϏͷϦϞίϯͷऔΓѻ͍ Summary • ςϨϏͷϦϞίϯͰ΋tvOSΞϓϦΛૢ࡞Ͱ͖Δɺ͔ͭɺ ςϨϏ͕͋Ε͹΄΅ηοτͰ࢖ΘΕΔ • ήʔϜΞϓϦͰͳ͚Ε͹ςϨϏͷϦϞίϯͰ΋ɺͻͱͱ ͓Γͷૢ࡞͕Ͱ͖Δ͜ͱ͕๬·͍͠ • UIKitͷίϯϙʔωϯτ͸Կ΋͠ͳͯ͘΋ςϨϏͷϦϞί ϯͰૢ࡞Ͱ͖ΔΑ͏ʹͳ͍ͬͯΔ΋ͷ͕ଟ͍ • ͦΕ͕Ώ͑ͷ༧ظͤ͵ޡಈ࡞΋͋ΔͨΊඞཁʹԠͯ͡ର ॲ

Slide 48

Slide 48 text

Agenda ✓tvOSͱiOSΞϓϦͷҧ͍ ✓ϑΥʔΧεͷऔΓѻ͍ ✓ςϨϏͷϦϞίϯͷऔΓѻ͍ • TVUIKit • Password AutoFill tvOS 12

Slide 49

Slide 49 text

TVUIKit

Slide 50

Slide 50 text

TVUIKit TVPosterView

Slide 51

Slide 51 text

TVUIKit TVCaptionButton

Slide 52

Slide 52 text

TVUIKit TVMonogramView

Slide 53

Slide 53 text

TVUIKit TVCardView

Slide 54

Slide 54 text

ࡉ͔͗͢Δ!?

Slide 55

Slide 55 text

ඞཁͳͷʁ

Slide 56

Slide 56 text

ඞཁͰ͢ɻ

Slide 57

Slide 57 text

ϑΥʔΧεͱࢹࠩޮՌ

Slide 58

Slide 58 text

UICollectionViewͱϑΥʔΧε

Slide 59

Slide 59 text

UICollectionViewͱϑΥʔΧε

Slide 60

Slide 60 text

UITableViewͱϑΥʔΧε

Slide 61

Slide 61 text

ϑΥʔΧεΞχϝʔγϣϯͷ࣮૷

Slide 62

Slide 62 text

// UICollectionViewDelegate func collectionView(_ collectionView: UICollectionView, didUpdateFocusIn context: UICollectionViewFocusUpdateContext, with coordinator: UIFocusAnimationCoordinator) { if let indexPath = context.previouslyFocusedIndexPath, let previously = collectionView.cellForItem(at: indexPath) { coordinator.addCoordinatedAnimations({ // ͜͜ͰϑΥʔΧεͷΞχϝʔγϣϯΛ࣮૷ }) } // ผ్ΞϯϑΥʔΧεͷΞχϝʔγϣϯΛ࣮૷ }

Slide 63

Slide 63 text

ϑΥʔΧεΞχϝʔγϣϯͷ࣮૷

Slide 64

Slide 64 text

ϑΥʔΧεΞχϝʔγϣϯͷ࣮૷

Slide 65

Slide 65 text

imageView.adjustsImageWhenAncestorFocused = true

Slide 66

Slide 66 text

No content

Slide 67

Slide 67 text

TVUIKit

Slide 68

Slide 68 text

TVPosterView

Slide 69

Slide 69 text

let posterView = TVPosterView(image: image) posterView.title = "title" posterView.subtitle = "subtitle"

Slide 70

Slide 70 text

TVCaptionButton

Slide 71

Slide 71 text

let captionButton = TVCaptionButtonView() captionButton.contentImage = image captionButton.title = "title" captionButton.subtitle = "subtitle"

Slide 72

Slide 72 text

UIMonogramView

Slide 73

Slide 73 text

let monogramView = TVMonogramView() monogramView.image = image monogramView.title = "name" monogramView.subtitle = “category"

Slide 74

Slide 74 text

UIMonogramView

Slide 75

Slide 75 text

UIMonogramView

Slide 76

Slide 76 text

TVCardView

Slide 77

Slide 77 text

let cardView = TVCardView() let originalView: UIView = { // ಠࣗͷViewͷߏங }() cardView.contentView.addSubview(originalView)

Slide 78

Slide 78 text

TVCardView

Slide 79

Slide 79 text

TVLockupView

Slide 80

Slide 80 text

TVUIKit TVDigitEntryViewController

Slide 81

Slide 81 text

let digitEntry = TVDigitEntryViewController() digitEntry.titleText = "৽͍͠ύείʔυΛ࡞੒" digitEntry.promptText = "4ܻͷ਺ࣈΛೖྗ͍ͯͩ͘͠͞ɻ" digitEntry.entryCompletionHandler = { entry in print(entry) } present(digitEntry, animated: true)

Slide 82

Slide 82 text

TVDigitEntryViewController

Slide 83

Slide 83 text

tvOS 11ͱಉ࣌αϙʔτͰ͖Δʁ

Slide 84

Slide 84 text

#if canImport(TVUIKit) import TVUIKit #endif @available(tvOS 12.0, *) private func showPassCodeEntry() { let digitEntry = TVDigitEntryViewController() // digitEntryͷϓϩύςΟઃఆΛͯ͠… present(digitEntry, animated: true) }

Slide 85

Slide 85 text

Summary • tvOSΞϓϦ͸؆୯ʹ࡞ΕΔ • ϑΥʔΧεΛ஌Δͷ͕ྑ͍tvOSΞϓϦΛ࡞Δۙಓ • ςϨϏͷϦϞίϯ΋๨Εͣʹ • TVUIKitʹΑΓtvOSΞϓϦΛ࡞Δͷ͕ΑΓ؆୯ʹ

Slide 86

Slide 86 text

Password AutoFill

Slide 87

Slide 87 text

Password AutoFill

Slide 88

Slide 88 text

Password AutoFill

Slide 89

Slide 89 text

Password AutoFill

Slide 90

Slide 90 text

Password AutoFill

Slide 91

Slide 91 text

More Information https://peaks.cc/iOS12 iOS 12 Programming ୈ10ষ tvOS 12ͷ৽ػೳ ϦϦʔε༧ఆ೔ 2018೥10݄31೔

Slide 92

Slide 92 text

Password AutoFill

Slide 93

Slide 93 text

Password AutoFill

Slide 94

Slide 94 text

Password AutoFill

Slide 95

Slide 95 text

Password AutoFill

Slide 96

Slide 96 text

Summary • tvOSΞϓϦ͸؆୯ʹ࡞ΕΔ • ϑΥʔΧεΛ஌Δͷ͕ྑ͍tvOSΞϓϦΛ࡞Δۙಓ • ςϨϏͷϦϞίϯ΋๨Εͣʹ • TVUIKitʹΑΓtvOSΞϓϦΛ࡞Δͷ͕ΑΓ؆୯ʹ • Password AutoFill΋ରԠ͸؆୯

Slide 97

Slide 97 text

ॴ ༑ଠ / Yuta Tokoro @tokorom tokorom More Information https://peaks.cc/iOS12 iOS 12 Programming ୈ10ষ tvOS 12ͷ৽ػೳ ϦϦʔε༧ఆ೔ 2018೥10݄31೔

Slide 98

Slide 98 text

ݩࢁ ࿨೭ / Kazuyuki Motoyama @kudakurage More Information http://kudakurage.hatenadiary.com/entry/2017/11/16/113657 Spinners Inc. UIσβΠϯدΓͷهࣄ

Slide 99

Slide 99 text

Ҿ༻ • Apple Human Interface Guidelines • Apple tvOS Application Programming Guide • WWDC 2018 Videos • www.apple.com