Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
UICollectionView Compositional Layout
Search
USAMI Kosuke
March 07, 2023
Programming
0
790
UICollectionView Compositional Layout
※ Docswell に移行しました
https://www.docswell.com/s/usami-k/Z3894J-uicollectionview-compositional-layout
USAMI Kosuke
March 07, 2023
Tweet
Share
More Decks by USAMI Kosuke
See All by USAMI Kosuke
Onsager代数とその周辺 / Onsager algebra tsudoi
usamik26
0
640
Apple HIG 正式名称クイズ結果発表 / HIG Quiz Result
usamik26
0
180
ゆめみ大技林製作委員会の立ち上げの話 / daigirin project
usamik26
0
330
@ViewLoadingプロパティラッパの紹介と自前で実装する方法 / @ViewLoading property wrapper implementation
usamik26
0
480
これからUICollectionViewを実践活用する人のためのガイド / Guide to UICollectionView
usamik26
1
750
Xcodeとの最近の付き合い方のはなし / Approach To Xcode
usamik26
2
670
Coding Swift with Visual Studio Code and Docker
usamik26
0
510
Swift Extension for Visual Studio Code
usamik26
2
1k
ソリトンとリー代数 / soliton history
usamik26
0
910
Other Decks in Programming
See All in Programming
脱Riverpod?fqueryで考える、TanStack Queryライクなアーキテクチャの可能性
ostk0069
0
320
PostgreSQLのRow Level SecurityをPHPのORMで扱う Eloquent vs Doctrine #phpcon #track2
77web
2
550
GitHub Copilot and GitHub Codespaces Hands-on
ymd65536
2
150
AI コーディングエージェントの時代へ:JetBrains が描く開発の未来
masaruhr
1
200
A full stack side project webapp all in Kotlin (KotlinConf 2025)
dankim
0
130
High-Level Programming Languages in AI Era -Human Thought and Mind-
hayat01sh1da
PRO
0
830
AIエージェントはこう育てる - GitHub Copilot Agentとチームの共進化サイクル
koboriakira
0
610
Porting a visionOS App to Android XR
akkeylab
0
640
ISUCON研修おかわり会 講義スライド
arfes0e2b3c
1
460
Deep Dive into ~/.claude/projects
hiragram
14
6.9k
#QiitaBash MCPのセキュリティ
ryosukedtomita
1
1.4k
Composerが「依存解決」のためにどんな工夫をしているか #phpcon
o0h
PRO
1
320
Featured
See All Featured
Side Projects
sachag
455
42k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
48
2.9k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
30
2.1k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
8
700
Building Applications with DynamoDB
mza
95
6.5k
Building a Scalable Design System with Sketch
lauravandoore
462
33k
Adopting Sorbet at Scale
ufuk
77
9.5k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.9k
Git: the NoSQL Database
bkeepers
PRO
430
65k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Transcript
UICollectionView Compositional Layout 振り返り 宇佐見公輔 / 株式会社ゆめみ 2023-03-07 UICollectionView Compositional
Layout 振り返り 1
自己紹介 宇佐見公輔(うさみこうすけ) 株式会社ゆめみ / iOSテックリード 大阪在住 UICollectionView Compositional Layout 振り返り
2
UICollectionView iOS 6 で登場した iOS 13 / 14 で大きく進化した Diffable
Data Source Compositional Layout UICollectionView Compositional Layout 振り返り 3
API構成 Data Layout Presentation UICollectionView Compositional 4
Layout Layout クラス(抽象クラス) UICollectionViewLayout Flow Layout : iOS 6〜 UICollectionViewFlowLayout
Compositional Layout : iOS 13〜 UICollectionViewCompositionalLayout UICollectionView Compositional Layout 振り返り 5
Compositional Layout でできること UICollectionView Compositional Layout 振り返り 6
Compositional Layout の構成 Layout Section Group Item UICollectionView Compositional Layout
振り返り 7
Layout ひとつのセクションにひとつの Section が対応する let layout = UICollectionViewCompositionalLayout { (sectionIndex,
layoutEnvironment) -> NSCollectionLayoutSection? in let section = NSCollectionLayoutSection(...) return section } ※ 全部同じ Section の場合は簡単な init もある let layout = UICollectionViewCompositionalLayout(section: section) UICollectionView Compositional Layout 振り返り 8
Section ひとつの Group を持つ let section = NSCollectionLayoutSection(group: group) ただし、Group
はネストできる let subgroups: [NSCollectionLayoutGroup] = ... let group = NSCollectionLayoutGroup.vertical( layoutSize: ..., subitems: subgroups ) let section = NSCollectionLayoutSection(group: group) UICollectionView Compositional Layout 振り返り 9
Group ひとつまたは複数個の Item を持つ let group = NSCollectionLayoutGroup.vertical( layoutSize: ...,
subitems: items ) let group = NSCollectionLayoutGroup.horizontal( layoutSize: ..., subitems: items ) UICollectionView Compositional Layout 振り返り 10
Item ひとつのデータに対応する let item = NSCollectionLayoutItem(layoutSize: ...) UICollectionView Compositional Layout
振り返り 11
それぞれの関係まとめ Layout はセクションごとに Section を持つ Section はひとつの Group を持つ(Group のネスト可能)
Group はひとつまたは複数個の Item を持つ Item はひとつのデータに対応する UICollectionView Compositional Layout 振り返り 12
Section / Group 「いくつかのものを並べる」 のはどちらも同じ どんなかたまりを Section に したらいいのか? どんなかたまりを
Group に したらいいのか? UICollectionView Compositional Layout 振り返り 13
Section と Group の違い Section Section 単位で設定する機能がある ネストできない Group Group
単位の機能はなく、レイアウト定義用のもの ネストできる UICollectionView Compositional Layout 振り返り 14
Section の機能 (1) Sticky Header pinToVisibleBounds セクションが変わると Pinned にな っていたヘッダーが消えてしまう
そのため、セクションの範囲を考慮 する必要がある UICollectionView Compositional Layout 振り返り 15
Section の機能 (2) 横スクロール orthogonalScrollingBehavior これはセクションのプロパティ 横スクロールしたい部分だけでセク ションにする必要がある UICollectionView Compositional
Layout 振り返り 16
Section の範囲を考える Section はネストできない そのため、セクションわけは実現したい機能に応じて決める必要が ある UICollectionView Compositional Layout 振り返り
17
ふたつの機能が両立 しないケース Sticky Header を右のような単位で つけたいとする すると、上部分の横スクロールを orthogonalScrollingBehavior では 実現できなくなる
UICollectionView Compositional Layout 振り返り 18
まとめ Section と Group はグルーピングの構造だが、役割が違う セクション単位で UI の機能を意識する必要がある 感想・ツッコミ・指摘・アドバイスなど歓迎します。 Sticky
Header と横スクロールを両立する方法が知りたい CollectionView in CollectionView か? UICollectionView Compositional Layout 振り返り 19