|
| 1 | +# 250228 UICollectionViewDiffableDataSource, ์ ๋๋ฉ์ด์
, ์ฑ๋ฅ |
| 2 | + |
| 3 | +`UICollectionViewDiffableDataSource`์ `apply` ๋ฉ์๋๋ฅผ ํธ์ถํ ๋ ํ๋ผ๋ฏธํฐ `animatingDifferences`๋ฅผ `true`๋ก ํ๋๊ฒ๊ณผ `false`๋ก ํ๋ ๊ฒ์ด ๋ด๋ถ ๋์ ์ฐจ์ด |
| 4 | + |
| 5 | +2์ 28์ผ (๊ธ) |
| 6 | + |
| 7 | +# ํ์ต๋ด์ฉ |
| 8 | + |
| 9 | +- `animatingDifferences: true`๋ ๋ฐ์ดํฐ ๊ฐ ์ฐจ์ด๋ฅผ ๊ณ์ฐํด ์ ๋๋ฉ์ด์
๊ณผ ํจ๊ป ์
๋ฐ์ดํธํ๋ฉฐ, `false`๋ ์ ๋๋ฉ์ด์
์์ด ๋ณ๊ฒฝ์ฌํญ๋ง ์ ์ฉํจ |
| 10 | +- iOS 13~14์์๋ false๊ฐ ๋จ์ reloadData์ฒ๋ผ ๋์ํ์ผ๋, iOS 15๋ถํฐ๋ diff ๊ณ์ฐ ํ ์ ๋๋ฉ์ด์
์ฌ๋ถ๋ง ๊ฒฐ์ ๋๋ค๊ณ ํ๋ค. |
| 11 | +- true์ผ ๋ ๋๊ท๋ชจ ๋ฐ์ดํฐ์
์
๋ฐ์ดํธ ์, ์ ๋๋ฉ์ด์
์ ์ฉ์ผ๋ก ์ธํด ์ถ๊ฐ ์
์์ฑ, UI ์
๋ฐ์ดํธ ์ด๋ฒคํธ๊ฐ ๋ง์ด ๋ฐ์ํ์ฌ CPU, GPU, ๋ฉ๋ชจ๋ฆฌ ๋ถํ๊ฐ ์ฆ๊ฐํ๊ฒ ๋๋ค. |
| 12 | + |
| 13 | +# ๊ณ ๋ฏผํ ์ / ํด๊ฒฐ๋ฐฉ๋ฒ |
| 14 | + |
| 15 | +### iOS ๋ฒ์ ๋ณ ๋์ ์ฐจ์ด ์ดํด |
| 16 | + |
| 17 | +iOS 13~14์์๋ `animatingDifferences: false`๊ฐ ์ ์ฒด reload์ฒ๋ผ ๋์ํด ์ฑ๋ฅ ๋ถ๋ด์ด ์ ์์ผ๋, iOS 15 ์ด์์์๋ diff ์ฐ์ฐ์ด ์ํ๋๋ฏ๋ก ์ ๋๋ฉ์ด์
์ฌ๋ถ๋ง ๋ฌ๋ผ์ง๋ค. |
| 18 | + |
| 19 | +* [https://www.jessesquires.com/blog/2021/07/08/diffable-data-source-behavior-changes-and-reconfiguring-cells-in-ios-15/](https://www.jessesquires.com/blog/2021/07/08/diffable-data-source-behavior-changes-and-reconfiguring-cells-in-ios-15/) |
| 20 | +* [https://developer.apple.com/videos/play/wwdc2021/10252](https://developer.apple.com/videos/play/wwdc2021/10252) |
| 21 | + |
| 22 | +### ๋๊ท๋ชจ ๋ฐ์ดํฐ ์
๋ฐ์ดํธ ์ต์ ํ |
| 23 | + |
| 24 | +๋๋์ ์
์
๋ฐ์ดํธ ์ ์ ๋๋ฉ์ด์
์ ์ฉ์ผ๋ก ๋ถํ์ํ ์
์์ฑ๊ณผ UI ์
๋ฐ์ดํธ๊ฐ ๋ฐ์ํด ์ฑ๋ฅ ์ ํ๋ฅผ ์ ๋ฐํ๋ค. ์ด์ ๋ฐ๋ผ ์ํฉ์ ๋ง๊ฒ animatingDifferences๋ฅผ `false`๋ก ์ฌ์ฉํ๊ฑฐ๋, iOS 15 ์ด์์ `applySnapshotUsingReloadData`๋ฅผ ํ์ฉํ๋ ๋ฐฉ๋ฒ์ ๊ณ ๋ คํ๋ฉด ๋๊ฒ ๋ค. |
| 25 | + |
| 26 | +- [https://developer.apple.com/forums/thread/706349#:~:text=Generally%20speaking%2C%20when%20you%20are,animation%20for%20the%20inserted%20cells](https://developer.apple.com/forums/thread/706349#:~:text=Generally%20speaking%2C%20when%20you%20are,animation%20for%20the%20inserted%20cells) |
| 27 | +- [https://stackoverflow.com/questions/73242482/uicollectionview-snapshot-takes-too-long-to-re-apply#:~:text=Using%20,rows%20by%20making%20this%20change](https://stackoverflow.com/questions/73242482/uicollectionview-snapshot-takes-too-long-to-re-apply#:~:text=Using%20,rows%20by%20making%20this%20change) |
| 28 | + |
| 29 | +### Diff ์ฐ์ฐ ๋น์ฉ๊ณผ UI ์
๋ฐ์ดํธ ๋ถ๋ด |
| 30 | + |
| 31 | +diff ์๊ณ ๋ฆฌ์ฆ์ `O(n)` ์ ํ ๋ณต์ก๋๋ฅผ ๊ฐ์ง์ง๋ง, ๋ณ๊ฒฝ ํญ๋ชฉ ์๊ฐ ๋ง์์ง์๋ก UI ์
๋ฐ์ดํธ ๋ฐ ์
์ฌ์์ฑ ๋น์ฉ์ด ๋์ ๋๋ค. ๋ฐ๋ผ์, ํ์ํ ๊ฒฝ์ฐ ๋ฐ์ดํฐ ํ์ด์ง์ด๋ ๋ฐฐ์น ์ฒ๋ฆฌ๋ฅผ ํตํด ํ ๋ฒ์ ์ฒ๋ฆฌํ๋ ์์ดํ
์๋ฅผ ์ ํํ๋ ์ ๋ต์ด ์ข๊ฒ ๋ค. |
| 32 | + |
| 33 | +### ์ค์ ๊ฐ๋ฐ ํ๊ฒฝ์์์ ์ฑ๋ฅ ๋ถ์ ์ค์์ฑ |
| 34 | + |
| 35 | +Instruments ๋ฐ ๊ฐ๋ฐ์ ์ปค๋ฎค๋ํฐ์ ์ฌ๋ก๋ฅผ ํตํด ์ฑ๋ฅ ํ
์คํธ์ ์ค์์ฑ์ ์ฌํ์ธํ์์ผ๋ฉฐ, ์ ๋๋ฉ์ด์
์ต์
์ ํ์ด UX์ ์ฑ๋ฅ ์ฌ์ด์ ํธ๋ ์ด๋์คํ์์ ๋ช
ํํ ์ธ์งํ๊ฒ ๋์๋ค. |
| 36 | + |
| 37 | +# ๋๋์ |
| 38 | + |
| 39 | +- diffable data source์ ๋ด๋ถ ๋์๊ณผ ์ ๋๋ฉ์ด์
์ต์
์ ๋ฐ๋ฅธ ์ฑ๋ฅ ์ฐจ์ด๋ฅผ ๋ช
ํํ๊ฒ ์ดํดํ ์ ์์์. |
| 40 | +- ์ํฉ์ ๋ง๋ ์ต์ ์ ์
๋ฐ์ดํธ ์ ๋ต ์๋ฆฝ์ ์ค์์ฑ์ ์ฌํ์ธํ๋ฉฐ, ์ค์ ํ
์คํธ ๋ฐ ํฌ๋ผ ์ฌ๋ก๊ฐ ํฐ ๋์์ด ๋จ. |
| 41 | +- ๋ฐ์ดํฐ ์๊ณผ ์
๋ฐ์ดํธ ๋ฐฉ์์ ๋ฐ๋ผ ์ฑ๋ฅ ์ต์ ํ๋ฅผ ์ํด ์ ๋๋ฉ์ด์
์ฌ์ฉ ์ฌ๋ถ๋ฅผ ์ ์คํ๊ฒ ์ ํํด์ผ ํ๋ค๋ ์ ์ ๊นจ๋ฌ์ |
| 42 | + |
| 43 | +--- |
| 44 | + |
| 45 | +# ์ฐธ๊ณ ๋งํฌ |
| 46 | + |
| 47 | +- [ChatGPT - apply animatingDifferences ์ฑ๋ฅ ์ฐจ์ด ๋ถ์](https://hackmd.io/@OsPD18twQM2Jv-q7O5bkWQ/rkBYnu0qyx) |
| 48 | +- [Apple ๊ฐ๋ฐ์ ๋ฌธ์ ๋ฐ WWDC ์์](https://developer.apple.com/videos/play/wwdc2021/10252/#:~:text=changes%2C%20its%20representation%20in%20diffable,First%2C%20let%27s) |
| 49 | +- [StackOverflow: diffable data source diff ๊ณ์ฐ ๊ด๋ จ](https://stackoverflow.com/questions/67996442/why-dispatchqueue-main-async-is-required-when-using-coredata-nsfetchedresultsco#:~:text=,method%20exclusively%20from%20the%20main) |
| 50 | +- [StackOverflow: UICollectionView ์ค๋
์ท ์ฑ๋ฅ ์ด์](https://stackoverflow.com/questions/73242482/uicollectionview-snapshot-takes-too-long-to-re-apply#:~:text=Using%20,rows%20by%20making%20this%20change) |
| 51 | +- [Jesse Squires ๋ธ๋ก๊ทธ: diffable data source ์ต์ ํ](https://www.jessesquires.com/blog/2024/12/19/diffable-data-source-main-actor-inconsistency/#:~:text=involved%20in%20creating%20cells%2C%20measuring,number%20of%20items%20populated%20in) |
| 52 | +- [Apple Developer Forums](https://forums.developer.apple.com/forums/thread/706349#:~:text=Generally%20speaking%2C%20when%20you%20are,animation%20for%20the%20inserted%20cells) |
0 commit comments