Slide 1

Slide 1 text

What's new in Xcode9 Interface Building by. 2017/6/27 GEEK GARAGE iOS vol3 (beta2) 2017/7/24 WWDC2017ৼΓฦΓษڧձˏFiNC (beta3) 1

Slide 2

Slide 2 text

takasek iOS Developer ϑϦʔϥϯε(΄΅FiNC) @takasek OSS ActionClosurable Notifwift౳ 2

Slide 3

Slide 3 text

͜ͷൃද͸ WWDC2017ͷηογϣϯ What's new in Xcode9 Interface Building ͷ಺༰঺հͰ͢ 3

Slide 4

Slide 4 text

΢ιͰ͢ 4

Slide 5

Slide 5 text

ͦΜͳηογϣϯͳ͔ͬͨͷͰ ͍͔ͭ͘ͷηογϣϯͷ৘ใΛर͍ूΊͨൃදͰ͢ 5

Slide 6

Slide 6 text

໨࣍ Dynamic Types safe areas 6

Slide 7

Slide 7 text

Dynamic Types 7

Slide 8

Slide 8 text

8

Slide 9

Slide 9 text

!" 9

Slide 10

Slide 10 text

10

Slide 11

Slide 11 text

! 11

Slide 12

Slide 12 text

ॏཁ౓↗ 4 iOS11ͷίϯτϩʔϧηϯλʔ ʹɺจࣈαΠζมߋͷίϯτ ϩʔϧ΋ઃஔͰ͖ΔΑ͏ʹͳ ΔΒ͍͠ 4 ͜Ε·Ͱ͸ઃఆappͷԞਂ ͘ʹ͋ͬͨ 4 ͜Ε͔Β͸ɺΑΓΧδϡΞ ϧʹϑΥϯταΠζ͕มߋ ͞Ε͏Δ 4 ͜Ε·ͰҎ্ʹҙࣝ͠ͳ͍ͱ Ϡό͍ 12

Slide 13

Slide 13 text

IBͰར༻͠΍ ͘͢ͳͬͨ Xcode8.3Ҏ߱ 4 Automatically Adjusts Font νΣοΫϘοΫε͕ ͍ͭͨ 4 Font sizeΛText Styleʹ มߋ͢ΔͷΛ๨Εͳ͍Α͏ ʹ 13

Slide 14

Slide 14 text

standard ͷ text sizeɾstyle͸ ͜Μͳ͔Μ͡ 14

Slide 15

Slide 15 text

Dynamic Type ֬ೝํ๏ʢSimulatorʣ 4 Accessibility Inspectorܦ༝ͰɺSimulatorͷϑΥϯταΠζΛߋ৽Ͱ͖Δ 15

Slide 16

Slide 16 text

UIFontMetricsͷڧԽ ίʔυͷ࿩ʹͳΔ͚Ͳ…iOS11Ҏ߱ɺ 4 System FontҎ֎Ͱ΋ Dynamic Type͕࢖͑ΔΑ͏ʹ 4 UIFontMetrics(forTextStyle: .title1) ɹɹɹɹɹɹɹɹɹɹ.scaledFont(for: customFont) 4 ೚ҙͷϑΥϯτ΍஋ΛɺDynamic TypeΛ௨ͯ͠ม׵Մ 4 UIFontMetrics(forTextStyle: .title1) ɹɹɹɹɹɹɹɹɹɹ.scaledValue(forValue: 40.0) 16

Slide 17

Slide 17 text

ϑΥϯταΠζΛେ͖͘ ͢ΔͱɺαΠζ͚ͩͰͳ ͘ϨΠΞ΢τ΋มΘΔ 4 Ϣʔβʔ࣮૷Ͱ΋ɺ UITraitCollection.preferredContentSizeCategory ʹ ैͬͯ৚݅෼ذɾϨΠΞ΢τΛมߋ͢Δ࣮૷͕ٻΊΒΕΔ 4 ৄࡉ͸Session 245 ͷ Building Apps with Dynamic Type ʹͯ 17

Slide 18

Slide 18 text

IBͰͷը૾ͷDynamic SizeରԠ 4 text͚ͩͰͳ͘ը૾αΠζ΋Dynamicʹ͍ͨ͠৔߹ 4 Assets͸VectorͰ༻ҙ 4 IBͰ͸ `Adjusts Image Size ΛΦϯʹ͢Δ 18

Slide 19

Slide 19 text

4 TabBarItemΛϩϯάϓϨ εͨ͠ͱ͖ͷϏϡʔͰ΋ɺ Dynamic SizeͰ֦େ͞Ε ͨը૾͕࢖ΘΕΔ 19

Slide 20

Slide 20 text

safe areas 20

Slide 21

Slide 21 text

safe areaͷޠݯ ςϨϏ! ͷϕθϧ(࿮)Ͱ ӅΕΔ৺഑ͷͳ͍ྖҬ 21

Slide 22

Slide 22 text

unsafe! 22

Slide 23

Slide 23 text

safe! 23

Slide 24

Slide 24 text

iOS։ൃͷͲ͜Ͱ ॏཁʹͳͬͯ͘Δ͔ʁ 24

Slide 25

Slide 25 text

25

Slide 26

Slide 26 text

Learge Title ! 26

Slide 27

Slide 27 text

NavigationBarͷߴ͞͸44pt! 27

Slide 28

Slide 28 text

NavigationBarͷߴ͞͸44pt! ͱ͍͏຀Վతͳ࣌୅͸ ऴΘΓ·ͨ͠ 28

Slide 29

Slide 29 text

iOS11ͷφϏήʔγϣϯόʔ͸ɺ 4 navigationItem.largeTitleDisplayMode ʹ ΑͬͯදࣔϞʔυ͕มಈ 4 LargeTitle͕εΫϩʔϧͰ֦ॖ 4 UISearchController ΋දࣔ͞ΕΔ 4 Refresh controls ΋දࣔ͞ΕΔ 29

Slide 30

Slide 30 text

30

Slide 31

Slide 31 text

31

Slide 32

Slide 32 text

32

Slide 33

Slide 33 text

33

Slide 34

Slide 34 text

34

Slide 35

Slide 35 text

35

Slide 36

Slide 36 text

SafeAreaʹ·ͭΘΔΫϥεͱϓϩύςΟ 4 UIView 4 var safeAreaLayoutGuide: UILayoutGuide { get } 4 ViewͰɺbar౳ͷίϯςϯπʹΑΓӅ͞ΕΔ෦෼Λࣔ͢ 4 UIViewController 4 var additionalSafeAreaInsets: UIEdgeInsets { get set } 4 ViewControllerͰɺsafeAreaͷࡉ͔͍ิਖ਼ʹ࢖͏insets 4 UIScreen 4 var overscanCompensationInsets: UIEdgeInsets { get } 4 ScreenͰɺΤοδͷΫϦοϐϯάΛආ͚ΔͨΊͷinsets 36

Slide 37

Slide 37 text

additionalSafeareaInsets ͬͯʁ ಠࣗͷόʔΛ͍࣋ͬͯΔViewControllerͰઃఆ͢Δ 37

Slide 38

Slide 38 text

UIViewͷ৽ઃϓϩύςΟ class UIView { var safeAreaLayoutGuide: UILayoutGuide { get } var safeAreaInsets: UIEdgeInsets { get } // safeAreaInsets ͕ߋ৽͞ΕͨΒݺ͹ΕΔ func safeAreaInsetsDidChange() // insetsΛ૬ରతʹ͢Δ͔Ͳ͏͔ɻσϑΥͰ͸ true var insetsLayoutMarginsFromSafeArea: Bool { get set } // ݴޠͷ޲͖ʹΑΔϚʔδϯ΋ઃఆͰ͖ΔΑ͏ʹͳͬͨ var directionalLayoutMargins: NSDirectionalEdgeInsets { get set } } 38

Slide 39

Slide 39 text

UIScrollViewͷ৽ઃϓϩύςΟ class UIScrollView { // enumɻ .automatic, .scrollableAxes, .never, .always ΛͱΔ var contentInsetAdjustmentBehavior : UIScrollViewContentInsetAdjustmentBehavior // ! automaticallyAdjustsScrollViewInsets ͷ୅ସ var adjustedContentInset: UIEdgeInsets { get } // adjustedContentInset ͕ߋ৽͞ΕͨΒݺ͹ΕΔ func adjustedContentInsetDidChange() // UIScrollViewͷ LalyoutGuide ΋औΕΔΑ͏ʹͳͬͨʂ var frameLayoutGuide: UILayoutGuide { get } var contentLayoutGuide: UILayoutGuide { get } } 39

Slide 40

Slide 40 text

TableViewपΓͰ͸ 4 Cellͷseparator , UITableViewCell , UITableViewHeaderFoote rView ͸ɺ ࣗ਎ͷsafearea΁ͷinset Λઃ͚ͯ͘ΕΔ 4 ϔομɾϑολʹ͸ඞͣ UITableViewHeaderFoote rView Λ࢖͍·͠ΐ͏ 40

Slide 41

Slide 41 text

Interface BuilderͰͷSafeAreaରԠ ɹɹɹɹɹɹɹɹɹɹFile Inspector!ɹɹɹɹɹɹɹ!View Hierarchy 41

Slide 42

Slide 42 text

Interface BuilderͰͷSafeAreaରԠ Use Safe Area Layout Guides ʹνΣοΫΛೖΕΔͱ… 42

Slide 43

Slide 43 text

Interface BuilderͰͷSafeAreaରԠ ɹɹɹɹɹɹɹɹɹɹFile Inspector!ɹɹɹɹɹ!஫໨!View Hierarchy!஫໨! 43

Slide 44

Slide 44 text

Interface BuilderͰͷSafeAreaରԠ TopLayoutGuide / BottomLayoutGuide ͕࢟Λม͑Δʂ 44

Slide 45

Slide 45 text

·ͱΊ ίʔυͰͷ෼ذ͸͍ͣΕ΍Δͱͯ͠΋ɺIBͷ ରԠ͸ࠓ͔ΒՄೳʂ iOS11࣌୅ʹඋ͑ͯɺࠓ͔ΒରԠ͍͖ͯ͠· ͠ΐ͏ʂ 45