Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Keep a list's scroll bar below its section headers on macOS 27

Țugui Dragoș361e54dead42
diff --git a/Peel/Views/SectionHeaderScrollBar.swift b/Peel/Views/SectionHeaderScrollBar.swift
index 65bae8d3..1f3dd4e3 100644
--- a/Peel/Views/SectionHeaderScrollBar.swift
+++ b/Peel/Views/SectionHeaderScrollBar.swift
@@ -3,11 +3,13 @@ import SwiftUI
extension View {
/// Starts a list's scroll bar below the band of a section header held at the top of the list, as Finder's starts
/// below its column headings. On macOS 27 it otherwise starts level with that band. `hasHeaders` is whether the
- /// list shows any section header at the moment.
+ /// list shows any section header at the moment. macOS 27 takes the margin only when the list is built, so the
+ /// list is built again when its headers come or go.
@ViewBuilder
func scrollBarBelowSectionHeaders(_ hasHeaders: Bool = true) -> some View {
if #available(macOS 27, *) {
contentMargins(.top, hasHeaders ? sectionHeaderBand : 0, for: .scrollIndicators)
+ .id(hasHeaders)
} else {
self
}