フィードやチャットのスクロールを全力でなめらかにする/iOSDC2019-LT

878cf5e0f8e3284f06c8968e961cecd4?s=47 dotrikun
September 06, 2019

 フィードやチャットのスクロールを全力でなめらかにする/iOSDC2019-LT

878cf5e0f8e3284f06c8968e961cecd4?s=128

dotrikun

September 06, 2019
Tweet

Transcript

  1. Copyright (C) 2018 DeNA Co.,Ltd. All Rights Reserved. Copyright (C)

    2018 DeNA Co.,Ltd. All Rights Reserved. ϑΟʔυ΍νϟοτͷ εΫϩʔϧΛશྗͰͳΊΒ͔ʹ͢Δ iOSDC 2019 Lightning Talks September 7, 2019 Hiroshi Shikata Healthcare
 DeNA Co., Ltd. 1
  2. Copyright (C) 2018 DeNA Co.,Ltd. All Rights Reserved. ηϧͷߴ͞ՄมͷTableView΍CollectionViewΛ࡞Δͱ͖ 2

  3. Copyright (C) 2018 DeNA Co.,Ltd. All Rights Reserved. Α͋͘Δߴ͕͞มΘΔηϧͷྫ 3

  4. Copyright (C) 2018 DeNA Co.,Ltd. All Rights Reserved. ςΩετͷจࣈ਺ʹΑͬͯߴ͕͞มΘΔ 4

  5. Copyright (C) 2018 DeNA Co.,Ltd. All Rights Reserved. UITableViewͰηϧͷߴ͞Λࣗಈʹઃఆ 5

  6. Copyright (C) 2018 DeNA Co.,Ltd. All Rights Reserved. දࣔͯ͠ 6

  7. Copyright (C) 2018 DeNA Co.,Ltd. All Rights Reserved. ҰؾʹεΫϩʔϧ͍ͯ͘͠ͱ 7

  8. Copyright (C) 2018 DeNA Co.,Ltd. All Rights Reserved. Ҿ͔͔ͬΔͱ͖͕͋Δ 8

    Ψο
  9. Copyright (C) 2018 DeNA Co.,Ltd. All Rights Reserved. ͳʹ͕ى͍ͬͯ͜Δͷ͔ Cell

    Cell Cell දࣔதͷηϧ
  10. Copyright (C) 2018 DeNA Co.,Ltd. All Rights Reserved. ͳʹ͕ى͍ͬͯ͜Δͷ͔ Cell

    Cell Cell Cell දࣔதͷηϧ εΫϩʔϧ Cell Prefetchର৅ʹͳͬͨηϧ ࣍ʹදࣔ͞ΕΔηϧ
  11. Copyright (C) 2018 DeNA Co.,Ltd. All Rights Reserved. ͳʹ͕ى͍ͬͯ͜Δͷ͔ Cell

    Cell Cell Cell දࣔதͷηϧ 1.Cellͷੜ੒ tableView(_:cellForRowAt:) Cell Prefetchର৅ʹͳͬͨηϧ ࣍ʹදࣔ͞ΕΔηϧ
  12. Copyright (C) 2018 DeNA Co.,Ltd. All Rights Reserved. ͳʹ͕ى͍ͬͯ͜Δͷ͔ Cell

    Cell Cell Cell දࣔதͷηϧ ࣍ʹදࣔ͞ΕΔηϧ 1.Cellͷੜ੒ tableView(_:cellForRowAt:) 2.Cellͷඳը tableView(_:willDisplay:) 3. CellͷϨΠΞ΢τ Cell Prefetchର৅ʹͳͬͨηϧ
  13. Copyright (C) 2018 DeNA Co.,Ltd. All Rights Reserved. ͳʹ͕ى͍ͬͯ͜Δͷ͔ Cell

    Cell Cell Cell දࣔதͷηϧ ࣍ʹදࣔ͞ΕΔηϧ 1.Cellͷੜ੒ tableView(_:cellForRowAt:) 2.Cellͷඳը tableView(_:willDisplay:) 3. CellͷϨΠΞ΢τ Cell Prefetchର৅ʹͳͬͨηϧ ߴࣗ͞ಈܭࢉͷ৔߹͸ ͜ͷؒʹηϧͷߴ͕͞ܭࢉ͞ΕΔ
  14. Copyright (C) 2018 DeNA Co.,Ltd. All Rights Reserved. FacebookͷதͷਓʹΑΔFacebookλΠϜϥΠϯͷٕज़ղઆ(2012) Ҿ༻:

    https://www.facebook.com/notes/facebook-engineering/under-the-hood-mobile-timeline/10150500366118920/
  15. Copyright (C) 2018 DeNA Co.,Ltd. All Rights Reserved. FacebookͷதͷਓʹΑΔFacebookλΠϜϥΠϯͷٕज़ղઆ(2012) ▪

    ϋʔυ΢ΣΞΞΫηϥϨʔγϣϯͷ࠷దԽ ▪ σβΠϯͷ޻෉ ͳͲ ʢը૾දࣔʹؔ͢Δ෦෼͔Βൈਮʣ ௨৴ϦΫΤετͷϢʔβΤʔδΣϯτ͔ΒσόΠ εͷ෺ཧతͳԣ෯Λܾఆ͠ɺͦͷԣ෯Λ࢖༻ͯ͠ ϖʔδ্ͷ͢΂ͯͷը૾ͷදࣔαΠζΛܾఆ͢Δ Ҿ༻: https://www.facebook.com/notes/facebook-engineering/under-the-hood-mobile-timeline/10150500366118920/
  16. Copyright (C) 2018 DeNA Co.,Ltd. All Rights Reserved. FacebookͷதͷਓʹΑΔFacebookλΠϜϥΠϯͷٕज़ղઆ(2012) ▪

    ϋʔυ΢ΣΞΞΫηϥϨʔγϣϯͷ࠷దԽ ▪ σβΠϯͷ޻෉ ͳͲ ʢը૾දࣔʹؔ͢Δ෦෼͔Βൈਮʣ ௨৴ϦΫΤετͷϢʔβΤʔδΣϯτ͔ΒσόΠ εͷ෺ཧతͳԣ෯Λܾఆ͠ɺͦͷԣ෯Λ࢖༻ͯ͠ ϖʔδ্ͷ͢΂ͯͷը૾ͷදࣔαΠζΛܾఆ͢Δ →ίϯςϯπͷදࣔαΠζ͸αʔόͰܭࢉࡁΈ Ҿ༻: https://www.facebook.com/notes/facebook-engineering/under-the-hood-mobile-timeline/10150500366118920/
  17. Copyright (C) 2018 DeNA Co.,Ltd. All Rights Reserved. ࣄલʹίϯςϯπͷαΠζΛܭࢉ͓ͯ͘͠ 17

  18. Copyright (C) 2018 DeNA Co.,Ltd. All Rights Reserved. ࣄલʹίϯςϯπͷදࣔαΠζΛܭࢉ͓ͯ͘͠ Cell

    Cell Cell TableView σʔλऔಘ & දࣔαΠζܭࢉ දࣔσʔλ&CellSize εΫϩʔϧલʹߴ͞͸͢΂ܾͯ·͍ͬͯΔ
  19. Copyright (C) 2018 DeNA Co.,Ltd. All Rights Reserved. ෯ͱදࣔ͢ΔςΩετ͕ܾ·Ε͹ߴ͞͸ࢉग़Ͱ͖Δ 19

    ςΩετͷจࣈ਺ʹΑͬͯߴ͕͞มԽ
  20. Copyright (C) 2018 DeNA Co.,Ltd. All Rights Reserved. ෯ͱςΩετ͕ܾ·Ε͹ߴ͞͸ࢉग़Ͱ͖Δ 20

    ▪ UILabel/UITextField / UITextViewͳͲUIViewΛܧঝͨ͠Class ▪ NSAttributedString
  21. Copyright (C) 2018 DeNA Co.,Ltd. All Rights Reserved. TableViewCellͱUILabelͷྫ 21

    1.UILabelͷԣ෯ΛܾΊΔ TableViewͷԣ෯ - ࠨӈϚʔδϯ TableViewͷԣ෯
  22. Copyright (C) 2018 DeNA Co.,Ltd. All Rights Reserved. TableViewCellͱUILabelͷྫ 22

    1. UILabelͷԣ෯ΛܾΊΔ TableViewͷԣ෯ - ࠨӈϚʔδϯ 2. UILabelͷαΠζΛࢉग़͢Δ 1ͷԣ෯Λࢦఆͯ͠ func sizeThatFits(_ size: CGSize) -> CGSize
  23. Copyright (C) 2018 DeNA Co.,Ltd. All Rights Reserved. ෯ͱදࣔ͢ΔςΩετ͕ܾ·Ε͹ߴ͞͸ࢉग़Ͱ͖Δ 23

    1. UILabelͷԣ෯ΛܾΊΔ TableViewͷԣ෯ - ࠨӈϚʔδϯ 2. UILabelͷαΠζΛࢉग़͢Δ 1ͷԣ෯Λࢦఆͯ͠ func sizeThatFits(_ size: CGSize) -> CGSize 3. Cellͷߴ͞Λࢉग़͢Δ 2Ͱܭࢉͨ͠ߴ͞ + ্ԼϚʔδϯ
  24. Copyright (C) 2018 DeNA Co.,Ltd. All Rights Reserved. tableView(_:cellForRowAt:) →

    ϨΠΞ΢τߋ৽׬ྃ·Ͱͷੑೳൺֱ 24 ߴࣗ͞ಈܭࢉͷ৔߹ ߴ͞Λࣄલʹܭࢉ ฏۉ (ϨΠΞ΢τߋ৽׬ྃ·Ͱ) ࠷େ (ϨΠΞ΢τߋ৽׬ྃ·Ͱ)
  25. Copyright (C) 2018 DeNA Co.,Ltd. All Rights Reserved. tableView(_:cellForRowAt:) →

    ϨΠΞ΢τߋ৽׬ྃ·Ͱͷੑೳൺֱ 25 ߴࣗ͞ಈܭࢉͷ৔߹ ߴ͞Λࣄલʹܭࢉ ฏۉ (ϨΠΞ΢τߋ৽׬ྃ·Ͱ) 14ms ࠷େ (ϨΠΞ΢τߋ৽׬ྃ·Ͱ) 95ms
  26. Copyright (C) 2018 DeNA Co.,Ltd. All Rights Reserved. tableView(_:cellForRowAt:) →

    ϨΠΞ΢τߋ৽׬ྃ·Ͱͷੑೳൺֱ 26 ߴࣗ͞ಈܭࢉͷ৔߹ ߴ͞Λࣄલʹܭࢉ ฏۉ (ϨΠΞ΢τߋ৽׬ྃ·Ͱ) 14ms 2ms ࠷େ (ϨΠΞ΢τߋ৽׬ྃ·Ͱ) 95ms 3ms
  27. Copyright (C) 2018 DeNA Co.,Ltd. All Rights Reserved. tableView(_:cellForRowAt:) →

    ϨΠΞ΢τߋ৽׬ྃ·Ͱͷੑೳൺֱ 27 ߴࣗ͞ಈܭࢉͷ৔߹ ߴ͞Λࣄલʹܭࢉ ฏۉ (ϨΠΞ΢τߋ৽׬ྃ·Ͱ) 14ms 2ms ࠷େ (ϨΠΞ΢τߋ৽׬ྃ·Ͱ) 95ms 3ms λΠϜϥΠϯ΍νϟοτ͕ΞϓϦͷίΞػೳͳΒؤுΔՁ஋͸͋Δʂ