Upgrade to Pro — share decks privately, control downloads, hide ads and more …

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

dotrikun
September 06, 2019

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

dotrikun

September 06, 2019
Tweet

More Decks by dotrikun

Other Decks in Programming

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. ͳʹ͕ى͍ͬͯ͜Δͷ͔ Cell

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

    Cell Cell Cell දࣔதͷηϧ 1.Cellͷੜ੒ tableView(_:cellForRowAt:) Cell Prefetchର৅ʹͳͬͨηϧ ࣍ʹදࣔ͞ΕΔηϧ
  4. 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ର৅ʹͳͬͨηϧ
  5. 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ର৅ʹͳͬͨηϧ ߴࣗ͞ಈܭࢉͷ৔߹͸ ͜ͷؒʹηϧͷߴ͕͞ܭࢉ͞ΕΔ
  6. 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/
  7. 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/
  8. 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/
  9. Copyright (C) 2018 DeNA Co.,Ltd. All Rights Reserved. ࣄલʹίϯςϯπͷදࣔαΠζΛܭࢉ͓ͯ͘͠ Cell

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

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

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

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

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

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

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

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

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