diff --git a/Tusker/Screens/Explore/TrendingStatusesViewController.swift b/Tusker/Screens/Explore/TrendingStatusesViewController.swift index 8b98ed4e..95b97fc9 100644 --- a/Tusker/Screens/Explore/TrendingStatusesViewController.swift +++ b/Tusker/Screens/Explore/TrendingStatusesViewController.swift @@ -60,7 +60,11 @@ class TrendingStatusesViewController: UIViewController { } return config } - let layout = UICollectionViewCompositionalLayout.list(using: config) + let layout = UICollectionViewCompositionalLayout { sectionIndex, environment in + let section = NSCollectionLayoutSection.list(using: config, layoutEnvironment: environment) + section.contentInsetsReference = .readableContent + return section + } view = UICollectionView(frame: .zero, collectionViewLayout: layout) collectionView.delegate = self collectionView.dragDelegate = self diff --git a/Tusker/Screens/Profile/ProfileStatusesViewController.swift b/Tusker/Screens/Profile/ProfileStatusesViewController.swift index 4458d83a..506e5537 100644 --- a/Tusker/Screens/Profile/ProfileStatusesViewController.swift +++ b/Tusker/Screens/Profile/ProfileStatusesViewController.swift @@ -80,7 +80,15 @@ class ProfileStatusesViewController: UIViewController, TimelineLikeCollectionVie } return config } - let layout = UICollectionViewCompositionalLayout.list(using: config) + let layout = UICollectionViewCompositionalLayout { [unowned self] sectionIndex, environment in + if case .header = dataSource.sectionIdentifier(for: sectionIndex) { + return .list(using: .init(appearance: .plain), layoutEnvironment: environment) + } else { + let section = NSCollectionLayoutSection.list(using: config, layoutEnvironment: environment) + section.contentInsetsReference = .readableContent + return section + } + } view = UICollectionView(frame: .zero, collectionViewLayout: layout) collectionView.delegate = self collectionView.dragDelegate = self diff --git a/Tusker/Screens/Timeline/TimelineViewController.swift b/Tusker/Screens/Timeline/TimelineViewController.swift index 4c1ac563..b5737552 100644 --- a/Tusker/Screens/Timeline/TimelineViewController.swift +++ b/Tusker/Screens/Timeline/TimelineViewController.swift @@ -87,7 +87,12 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro } return config } - let layout = UICollectionViewCompositionalLayout.list(using: config) + // just setting layout.configuration.contentInsetsReference doesn't work with UICollectionViewCompositionalLayout.list + let layout = UICollectionViewCompositionalLayout { sectionIndex, environment in + let section = NSCollectionLayoutSection.list(using: config, layoutEnvironment: environment) + section.contentInsetsReference = .readableContent + return section + } collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout) collectionView.delegate = self collectionView.dragDelegate = self