Debugging To The Gate

Debugging To The Gate

at YUMEMI.swift #7 ~あつまれルーキーの森~

1405a601755e5fcbfdc93a2560368bb1?s=128

freddi(Yuki Aki)

May 15, 2020
Tweet

Transcript

  1. YUMEMI.swift #7 - 15th/May/2020 Debugging To The Gate! freddi (@_

    _ _freddi _ _ _) from LINE Fukuoka
  2. ϫΠʹ͍ͭͯ • freddi (@_ _ _freddi _ _ _) •

    ৽ଔ̎೥໨@ LINE Fukuoka • try! Swift ͱ͔ొஃͨ͠ • Tokyo, NYC 2019
  3. λΠτϧʹ͍ͭͯ • STEINS; GATEͱ͍͏Ξχϝͷओ୊Վ͕ݩωλ • ຊ౰͸ओਓެͷཱͪճΓΛΈͯσόοάज़Λ ֶͿ࿩ͩͬͨ • ͕ɺωλόϨʹͳΔͷͰͦͷ෦෼͸ׂѪ •

    Կ΋લ৘ใͳ͠ʹݟΔͷ͕໘നϙΠϯτ
  4. ͜ͷτʔΫͷझࢫ • σόοάͰͷߟ͑ํɾඞཁͳ͜ͱΛ਎ʹ͚ͭΔ • ຊ౰ʹ৽ਓ޲͚

  5. ࿩ͷྲྀΕ • ͍͔ͭ͘ͷʮΑ͋͘ΔσόοάͷέʔεʯΛ঺հ • ͦͷ࣌ͷ๻ͷߟ͑ͨྫΛܰ͘঺հ • ໾ཱͭπʔϧͱ͔΋঺հ • ݁ہσόοάͬͯͳʹʁ

  6. σόοάͱ͸

  7. σόοάͱ͸ • ίϯϐϡʔλϓϩάϥϜͷόάɾܽؕΛൃݟ͓ Αͼमਖ਼͠ɺಈ࡞Λ࢓༷௨Γͷ΋ͷͱ͢ΔͨΊ ͷ࡞ۀͰ͋Δ • By σόοά - Wikipedia

    • De “Bug”
  8. ͲΜͳσόοάͷέʔε͕͋Δͷ͔ ※ ͍͍ͩͨ๻ͷܦݧྫ

  9. ʮ͔͚ͯ͠·͏ʯίʔυ

  10. ʮ͔͚ͯ͠·͏ʯίʔυ • ʮॻ͘ʯͱʮܽ͘ʯͷμϒϧϛʔχϯά • Swiftͷศརͳॻ͖ํ͕ىҼ͢Δόά • ৽ػೳΛ࣮૷͢Δࡍʹؒҧͬͯফͨ͠ίʔυ • ίϯύΠϧɾϏϧυ͕௨ͬͯ͠·͏

  11. ʮ͔͚ͯ͠·͏ʯίʔυʢྫʣ • ͜ͷΫϥογϡόά͸ॻ͖ํʹىҼ static func showDialog(on viewController: UIViewController) { let

    viewController = DialogViewController() viewController.present(viewController, animated: true) }
  12. ͜͏͍͏ͱ͖ͷσόοά • Ϋϥογϡ෦෼ΛաڈͷίʔυͱൺֱΛ͢Δ • ϓϩδΣΫτʹתೳʹͳͬͯΔͱͳ͓ྑ͍ • ม਺໊ͷ࢖͍ํʹ͸ؾΛ͚ͭͯΈΔ • ໾ׂΛߟ໊ྀͨ͠લΛ͚ͭΔ •

    viewController => dialogViewController
  13. ݪҼͱτϦΨʔ͕ಉ͡Ͱ͋Δͱ͸ݶΒͳ͍

  14. None
  15. ͜ͷهࣄͷ໘ന͍ϙΠϯτ • ۮવʮൃ۷ʯ͞Εͨόά • ϑΥʔΧεͯ͠Δػೳͱҧ͏ͷͰղ໌͕ࠔ೉ • ݪҼͱʮ࠶ݱํ๏ʯͷؔ࿈ੑ͕࠷ॳݟ͑ͳ͍

  16. ࣮ࡍʹ͋ͬͨ΍ͭʢྫʣ • ຖόʔδϣϯΞοϓޙʹىಈ࣌ͷΫϥογϡ • ى͖ͳ͍৔߹͕ଟ͔ͬͨͬΆ͍ • ͋Δόʔδϣϯ͔ΒϦϦʔε͢Δͨͼʹ … • खݩͰ࠶ݱෆՄ

    • ώϯτ͸ΫϥογϡղੳπʔϧͷϩάͷΈ
  17. ͜͏͍͏ͱ͖ͷσόοά • Ͱ͖ΔݶΓελοΫτϨʔεΛಡΉ • ϥΠϒϥϦͷίʔυ·ͰͨͲͬͯݪҼղ໌ • ߟ͑ΒΕΔ͢΂ͯͷέʔεΛચ͍ग़͢ • Ϋϥογϡݩͷؔ࿈ॲཧશ෦

  18. ݪҼ • ΞϓϦͷΞοϓσʔτޙ͸ • DBͷϚΠάϨʔγϣϯ͕ඞਢ • ϚΠάϨʔγϣϯલʹDB΁ͷΞΫηε͕ൃՐ • σʔλͷෆ੔߹͕ى͖ͯΫϥογϡ͢Δ

  19. ݪҼ • ͋Δόʔδϣϯ͔Β… • ىಈ࣌ʹσʔλΛऔಘ͢Δॲཧ౤ೖ • ऴྃ࣌ʹDBʹσʔλೖΕͯͨ • ͨ·ʹϚΠάϨʔγϣϯ͕஗͘ͳͬͯ

  20. ରॲ • ελοΫτϨʔεͨͲͬͨΒDBΞΫηεͩͬͨ • ॳճىಈ࣌ͷDBͷॲཧચ͍ग़͠ • ॳճىಈ࣌ͷDBΞΫηεͷϦϑΝΫλ • ϚΠάϨʔγϣϯऴྃ࣌ʹΞΫηε͢Δ •

    DBΞΫηεॲཧͷݟ௨͠Λྑ͘͢Δ
  21. ʮͰ͖Δʯ͕ʮ޲͍͍ͯΔʯͱ͸ݶΒͳ͍

  22. Ͱ͖Δίʔυͷؒҧͬͨ࢖͍ํ • ͦΕͳΓʹ໽հͳ΍ͭ • Ͱ͖Δ͔Βͱ͍ͬͯɺ͍͋ͬͯΔͱ͸ݶΒͳ͍ • ʮͰ͖ΔʯόΠΞε͕͔͔ͬͯ͠·͏ • όΠΞεͰɺࠜຊతͳݪҼΈͳͤͳ͍

  23. ࣮ࡍʹ͋ͬͨ΍ͭʢྫʣ • UIPageViewControllerͷϖʔδભҠ࣌ͷॲཧ extension PageViewController : UIPageViewControllerDataSource { func pageViewController(…,

    viewControllerBeforeViewController … { ... callWhenPageChanged() // ϖʔδ͕มΘͬͨΒݺͼ͍ͨॲཧ ... /*Կ͔͠ΒͷViewControllerΛreturn͢Δॲཧ*/ }
  24. ࣮ࡍʹ͋ͬͨ΍ͭʢྫʣ • લͷίʔυ͸ؒҧ͍ • ͔ͨ͠ʹϖʔδભҠ࣌ʹݺ͹ΕΔ • ͕ɺॲཧͷ౎߹্ෳ਺ճݺ͹Εͯ͠·͏ • ͨ·ʹ͜ΕΛॻ͍ͯΔղઆαΠτ͕͋Δ •

    ղઆαΠτόΠΞεʹ΋஫ҙ
  25. ݪҼ • UIPageViewControllerDataSource ͸ • ϖʔδભҠͷڍಈͷDelegate͡Όͳ͍ • UIPageViewControllerDelegate Λ࢖͓͏

  26. ͜͏͍͏ͱ͖ͷσόοά • AppleͷެࣜͷϦϑΝϨϯεΛͳΔ΂͘ಡ΋͏ • ୈ̍ʹΑΉ΂͖ղઆαΠτͰ͢ • ผͷղઆαΠτͰಘͨ಺༰͸ˢͰ΋ΈͯΈΔ

  27. Ͱ͖Δίʔυͷؒҧͬͨ࢖͍ํʢྫʣ • ਖ਼ղྫͷίʔυ͕ͪ͜Β extension PageViewController: UIPageViewControllerDelegate { // δΣενϟʔʹΑΔભҠ͕ऴΘͬͨ৔߹ʹݺ͹ΕΔ func

    pageViewController(… previousViewControllers: [UIViewController], transitionCompleted: Bool) { ... callWhenPageChanged() // ϖʔδ͕มΘͬͨΒݺͼ͍ͨॲཧ
  28. πʔϧΛ࢖͍͜ͳͦ͏

  29. ਓతϨϏϡʔͷݶք • ਓؒ͸ෆ҆ఆʢਅཧʣ • ͦΜͳਓ͕ؒϨϏϡʔͯ͠΋౰વ͍͔ͭϛεΔ • ͳΒ࢖͑ΔπʔϧΛ࢖͓͏ɾ஌͓ͬͯ͜͏

  30. ͨ͘͞Μͷπʔϧ • πʔϧ͸࢖͍͜ͳͤΔ΄ͲΑ͍ • όάΛݟ͚ͭΔͨΊͷ෢ثʹͳΔ • ࣗ෼ͰπʔϧΛ࡞Δͷ΋ྑ͍ • πʔϧΛ࡞ͬͨͷ΋ಉ͡໰୊ʹૺͬͨਓؒ

  31. LLDB • ϒϨʔΫϙΠϯτઃఆ͢Δͱ͖ʹͰͯ͘ΔίϨ

  32. LLDB • ͔͜͜Βݱࡏࢭ·͍ͬͯΔ৔ॴͷ৘ใ͕औΕΔ • po hoge ← ม਺hogeʹத਎͕ϩά͞ΕΔ

  33. LLDB • LLDB Code Injection • ίʔυΛ஫ೖ༷ͯ͠ʑͳঢ়ଶΛ૝ఆͰ͖Δ • https://youtu.be/lm4sEcMxua0

  34. Network Link Conditioner • ి೾ͷѱ͍ঢ়گͱ͔࠶ݱͰ͖Δ • https://dev.classmethod.jp/articles/network- link-conditioner/ • ͖ͬ͞ͷDBͷରॲͷͱ͖ʹ໾ཱͬͨ

  35. XCTAssertNoLeak • ϝϞϦϦʔΫ͸ൃ೤ͱ͔ͷݪҼʹ΋ͳΔ • ϝϞϦϦʔΫΛςετͰݟ͚ͭΔ͜ͱ͕Ͱ͖Δ • ϨϏϡʔͰͷݟམͱ͠ΛΧόʔ • https://techlife.cookpad.com/entry/ 2020/03/03/115000

  36. Gedatsu • Auto LayoutͷΤϥʔ͸ը໘ભҠΛ஗͘͢Δ • Auto LayoutͷΤϥʔ͸ݟʹ͍͘ɾɾɾ • ͜ͷΤϥʔϩάΛGedatsu͸ݟ΍͘͢͢Δ •

    https://bannzai.hatenadiary.jp/entry/ 2020/05/08/091825
  37. Gedatsu

  38. όά͸Ӆͣ͞ʹใࠂɾमਖ਼͢Δ

  39. ʮζϧΛ͢ΔͳʯɺͰ͸ͳ͘ɾɾɾ • ζϧΛ͠ͳ͍ͷͰ͸ͳ͍ʢਓͱͯ͠౰વʣ • OSSͷόάͳΒ͹ Issue Λཱͯͯใࠂ͠Α͏ • ੈքͷ୭͔΋ͦΕʹࠔ͍ͬͯ·͢ •

    ͡Όͳ͍ͱɺ͍ͭ·Ͱͨͬͯ΋௚Γ·ͤΜ
  40. ҙ֎ͱOSS׆ಈ΁ͷۙಓʹͳΔ • OSS ׆ಈ΁ܨ͕Δ • େ୾ʹमਖ਼ύονͱ͔ग़ͯ͠ΈΔ • ୭͔Β΋ධՁ͞ΕΔߦಈͰ͢ʂ • ΤϯδχΞͱͯ͠ͷܦݧ஋Ξοϓ

  41. ๻ͷྫ • OSSʹཉ͍͠ػೳΛ௥Ճͨ͠

  42. ʲେࣄʳόάͷઐ໳ՈʹͳΔ

  43. ઐ໳ՈʹͳΔͱ͸ • όάʹଟ͘Ϳͪ౰ͨͬͯݪҼΛ෼ੳ͢Δ • ཁ͢Δʹ୔ࢁίʔυΛॻ͍ࣦͯഊ͍ͯͩ͘͠͞ • ͦͯ͠όάΛ஌͍ͬͯͩ͘͞

  44. ઐ໳ՈʹͳΔͱ͸ • ͜ͷք۾͸ܦݧ໋͕Ͱ͢ • ࣌ؒͷ௕͞Ͱ͸ͳ͘ྔͰ͢ • ͨ͘͞Μϛε͍ͬͯͩ͘͞

  45. Μʁ

  46. ཁ͢Δʹσόοάͬͯܦݧ͡ΌͶʁ

  47. ܦݧ஋্͍͛ͯ͜͏ • ͍͍ͩͨଠࣈʹͳ͍ͬͯΔ΍ͭ͸ܦݧ͕ؔ࿈ • πʔϧΛͨ͘͞Μ࢖͍ͬͯΔ͔ • ϦϑΝϨϯεΛͨ͘͞ΜಡΜͰΔ͔ • ͦͷόάΛ஌͍ͬͯΔ͔ •

    ίʔυΛॻ͍ͯόάʹଟ͘Ϳͪ౰ͨͬͯΔ͔
  48. ͋·ΓܦݧΛੵΉঢ়گ͕ݟ͔ͭΒͳ͍ • ࣗΒ͢͢ΜͰσόοά͢Δ͔͠ແ͍ • ͳʹ͔ͷϓϩδΣΫτʹ͍ΔͳΒɾɾɾ • όάͷνέοτʢҊ݅ʣΛࣗओతʹ΍Ζ͏ • OSSͰ΋͍͍Ͱ͢

  49. ·ͱΊ

  50. ·ͱΊ • ཁ͢Δʹσόοά͸ܦݧ͕ੜ͖ΔͷͰؤுΖ͏ • ୔ࢁίʔυॻ͍ͯόάͷઐ໳ՈʹͳΔ • πʔϧ͸࢖͑Δ͚ͩ࢖͓ͬͯ͘ etc…

  51. ࢀߟจݙʢ֤ϖʔδʹࡌͤͯͳ͍΍ͭʣ • iOSDC Japan 2019: ςετέʔεͰ Ambiguous Layout Λൃݟ͢Δ •

    https://youtu.be/RMicLhmPY84
  52. ࢀߟจݙʢ֤ϖʔδʹࡌͤͯͳ͍΍ͭʣ • όχϥͷΞΠεΛങͬͨͱ͖͚ͩंͷΤϯδϯ ͕͔͔Βͳ͘ͳΔෆࢥٞͳݱ৅ɺͦͷݪҼ͸ʁ • https://gigazine.net/news/20200511-vanilla- ice-allergic-car/

  53. એ఻

  54. try! Swift WorldͷΠϯετϥΫλʔͰ͢