https://developer.apple.com/videos/play/wwdc2020/10026

WWDC 2020 | Advances in UICollectionView 에서 이야기한 내용 중
List Configuration과 List Cell에 대해 이야기합니다.
Lists in CollectionView
CollectionView에서 UITableView 처럼 생긴 Layout을 만들 수 있다.
iOS 13에서 발표된 Compositional Layout에 기초를 두고있다.
Customize할 수 있고 하기 쉽다.
self sizing을 제공한다


UICollectionLayoutListConfiguration
– lists를 build하기 위한 Layout
– NSCollectionLayoutSection의 가장 위에서 build된다.
List의 Style 설정하기
TableView와 비슷하당
List는 TableView의 「.plane, .grouped, .insetGrouped」는 물론 새롭게 2가지의 style이 추가됐다.
– .sideBar, .sideBarplane
💡 List는 전체적으로도 Style을 설정할 수 있고 Section별로 다른 스타일을 설정할 수도 있다.
Tutorial

– 이렇게 설정하면 List 전체에 .insetGrouped 스타일 하나만 설정된다.

– List의 최고 장점은 !!!!!!!!! Section마다 다르게 스타일을 지정할 수 있으니까 활용해주시길 바란다 🤔
Headers and Footers
UITableView의 Header/Footer처럼 사용하기 위해서는 2가지 방법이 있다.
첫 번째 방법) Register as Supplementary View

두 번째 방법) List의 첫 번째 item을 section으로 한다

List Cell
UICollectionViewListCell (iOS14 ~) NEW
UICollectrionViewCell의 subclass
물론 UICollectionViewListCell 말고 UICollectionViewCell을 List에서 사용할 수 있다.
가능한 것들
– Separators
– Indentation 인덴트
– Swipe Actions
– Accessories
– Default Content Configurations
Separators (= Saparator Layout Guide)


Swipe Actions

– 코드는 cell.trailingSwipeActionsConfiguration 으로 설정하면 왼쪽으로 나타나는 Swipe Action을 설정하는것도 물론 가능하다.


– markItemAsFavorite에서는 indexPath를 사용하면 절 !!!! 대 안된다 !!!!! DiffableDataSource 시대에 맞는 item.identifier를 사용해쥬자
Accessories
UITableView의 Accessories API는 꽤나 한정적이었다. (이제와서,,,요….? 😅)
새롭고 다양한 타입의 Accessaries API를 ListCell에서 제공
– Leading, Trailing 양쪽에서 사용가능하다 !!!!!
– 한쪽에 여러개의 Accessary를 사용할 수도 있다

– 두 개의 accessary를 추가하더라도 .delete()는 List가 edit mode일 때만 표시되니 안심해도 된다.

– 반대로 .disclosureIndicator가 edit mode에서 나타나지 않도록 표시할 수도 있다.
[…] 할 수 있다 ! – UITableView의 Swipe Actions를 사용할 수 있다.Common cell layouts🔗 WWDC 2020 | Lists in UICollectionView장점– Simple– Per-section or entire […]
좋아요좋아요