@@ -76,7 +76,6 @@ final class GridViewController: ExampleViewController, CellEventCoordinator {
7676 // MARK: Private
7777
7878 private static func makeLayout( ) -> UICollectionViewCompositionalLayout {
79- let fractionalWidth = CGFloat ( 0.5 )
8079 let inset = CGFloat ( 4 )
8180
8281 // Supplementary Item
@@ -89,15 +88,17 @@ final class GridViewController: ExampleViewController, CellEventCoordinator {
8988 containerAnchor: badgeAnchor)
9089
9190 // Item
92- let itemSize = NSCollectionLayoutSize ( widthDimension: . fractionalWidth( fractionalWidth ) ,
93- heightDimension: . fractionalHeight( 1 ) )
91+ let itemSize = NSCollectionLayoutSize ( widthDimension: . fractionalWidth( 1.0 ) ,
92+ heightDimension: . fractionalHeight( 1.0 ) )
9493 let item = NSCollectionLayoutItem ( layoutSize: itemSize, supplementaryItems: [ badge] )
9594 item. contentInsets = NSDirectionalEdgeInsets ( top: inset, leading: inset, bottom: inset, trailing: inset)
9695
9796 // Group
98- let groupSize = NSCollectionLayoutSize ( widthDimension: . fractionalWidth( 1 ) ,
99- heightDimension: . fractionalWidth( fractionalWidth) )
100- let group = NSCollectionLayoutGroup . horizontal ( layoutSize: groupSize, subitems: [ item] )
97+ let groupSize = NSCollectionLayoutSize ( widthDimension: . fractionalWidth( 0.5 ) ,
98+ heightDimension: . fractionalHeight( 0.5 ) )
99+ let group = NSCollectionLayoutGroup . vertical ( layoutSize: groupSize,
100+ subitem: item,
101+ count: 2 )
101102
102103 // Headers and Footers
103104 let headerFooterSize = NSCollectionLayoutSize ( widthDimension: . fractionalWidth( 1.0 ) ,
@@ -113,6 +114,7 @@ final class GridViewController: ExampleViewController, CellEventCoordinator {
113114
114115 // Section
115116 let section = NSCollectionLayoutSection ( group: group)
117+ section. orthogonalScrollingBehavior = . continuous
116118 section. contentInsets = NSDirectionalEdgeInsets ( top: inset, leading: inset, bottom: inset, trailing: inset)
117119 section. boundarySupplementaryItems = [ sectionHeader, sectionFooter]
118120
0 commit comments