diff --git a/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewController.swift b/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewController.swift index 604e23825..3da704f0b 100644 --- a/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewController.swift +++ b/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewController.swift @@ -44,6 +44,11 @@ final class MastodonPickServerViewController: UIViewController, NeedsDependency tableView.backgroundColor = .clear tableView.keyboardDismissMode = .onDrag tableView.translatesAutoresizingMaskIntoConstraints = false + if #available(iOS 15.0, *) { + tableView.sectionHeaderTopPadding = .leastNonzeroMagnitude + } else { + // Fallback on earlier versions + } return tableView }() @@ -428,7 +433,9 @@ extension MastodonPickServerViewController: UITableViewDelegate { } func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { - guard let diffableDataSource = viewModel.diffableDataSource else { return 0 } + guard let diffableDataSource = viewModel.diffableDataSource else { + return .leastNonzeroMagnitude + } let sections = diffableDataSource.snapshot().sectionIdentifiers let section = sections[section] switch section { @@ -442,10 +449,20 @@ extension MastodonPickServerViewController: UITableViewDelegate { // Same reason as above return 10 case .servers: - return 0 + return .leastNonzeroMagnitude } } + func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { + let footerView = UIView() + footerView.backgroundColor = .yellow + return footerView + } + + func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat { + return .leastNonzeroMagnitude + } + func tableView(_ tableView: UITableView, willSelectRowAt indexPath: IndexPath) -> IndexPath? { guard let diffableDataSource = viewModel.diffableDataSource else { return nil } guard let item = diffableDataSource.itemIdentifier(for: indexPath) else { return nil } diff --git a/Mastodon/Scene/Root/Sidebar/View/SidebarAddAccountCollectionViewCell.swift b/Mastodon/Scene/Root/Sidebar/View/SidebarAddAccountCollectionViewCell.swift index a4bd5833e..72b2577f1 100644 --- a/Mastodon/Scene/Root/Sidebar/View/SidebarAddAccountCollectionViewCell.swift +++ b/Mastodon/Scene/Root/Sidebar/View/SidebarAddAccountCollectionViewCell.swift @@ -26,6 +26,8 @@ extension SidebarAddAccountCollectionViewCell { private func _init() { } override func updateConfiguration(using state: UICellConfigurationState) { + super.updateConfiguration(using: state) + var newBackgroundConfiguration = UIBackgroundConfiguration.listSidebarCell().updated(for: state) // Customize the background color to use the tint color when the cell is highlighted or selected.