Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.
Swift cache-cleanercleanerclideveloper-toolsdisk-cleanupdisk-spaceduplicate-finderhomebrewliquid-glassmac-cleanermacosmacos-appmacos-golden-gatemacos-tahoemacos-tweaksswiftswiftuiterminal-themesuninstalluninstaller
Show an app's update in a panel of its own
Țugui Dragoșbc5887be0c9b
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstringsindex 05f46425..ffec02f5 100644--- a/Localization/Peel/Localizable.xcstrings+++ b/Localization/Peel/Localizable.xcstrings@@ -6693,112 +6693,6 @@}}},- "%@, update available: %@" : {- "localizations" : {- "cs" : {- "stringUnit" : {- "state" : "translated",- "value" : "%@, je k dispozici aktualizace: %@"- }- },- "de" : {- "stringUnit" : {- "state" : "translated",- "value" : "%@, Update verfügbar: %@"- }- },- "es" : {- "stringUnit" : {- "state" : "translated",- "value" : "%@, actualización disponible: %@"- }- },- "fr" : {- "stringUnit" : {- "state" : "translated",- "value" : "%@, mise à jour disponible : %@"- }- },- "it" : {- "stringUnit" : {- "state" : "translated",- "value" : "%@, aggiornamento disponibile: %@"- }- },- "ja" : {- "stringUnit" : {- "state" : "translated",- "value" : "%@、アップデートあり: %@"- }- },- "ko" : {- "stringUnit" : {- "state" : "translated",- "value" : "%@, 업데이트 사용 가능: %@"- }- },- "nl" : {- "stringUnit" : {- "state" : "translated",- "value" : "%@, update beschikbaar: %@"- }- },- "pl" : {- "stringUnit" : {- "state" : "translated",- "value" : "%@, dostępne uaktualnienie: %@"- }- },- "pt" : {- "stringUnit" : {- "state" : "translated",- "value" : "%@, atualização disponível: %@"- }- },- "ro" : {- "stringUnit" : {- "state" : "translated",- "value" : "%@, actualizare disponibilă: %@"- }- },- "ru" : {- "stringUnit" : {- "state" : "translated",- "value" : "%@, доступно обновление: %@"- }- },- "sv" : {- "stringUnit" : {- "state" : "translated",- "value" : "%@, uppdatering tillgänglig: %@"- }- },- "tr" : {- "stringUnit" : {- "state" : "translated",- "value" : "%@, güncelleme var: %@"- }- },- "uk" : {- "stringUnit" : {- "state" : "translated",- "value" : "%@, доступне оновлення: %@"- }- },- "zh-Hans" : {- "stringUnit" : {- "state" : "translated",- "value" : "%@,有更新可用:%@"- }- },- "zh-Hant" : {- "stringUnit" : {- "state" : "translated",- "value" : "%@,有可用的更新:%@"- }- }- }- },"%@: %@" : {"comment" : "What VoiceOver reads for a button. The first %@ is the action, such as Install. The second is what it acts on, such as Helper.","localizations" : {@@ -167118,214 +167012,108 @@}}},- "Show Less" : {+ "Show More…" : {"localizations" : {"cs" : {"stringUnit" : {"state" : "translated",- "value" : "Zobrazit méně"+ "value" : "Zobrazit více…"}},"de" : {"stringUnit" : {"state" : "translated",- "value" : "Weniger anzeigen"+ "value" : "Mehr anzeigen …"}},"es" : {"stringUnit" : {"state" : "translated",- "value" : "Mostrar menos"+ "value" : "Mostrar más…"}},"fr" : {"stringUnit" : {"state" : "translated",- "value" : "En afficher moins"+ "value" : "En afficher plus…"}},"it" : {"stringUnit" : {"state" : "translated",- "value" : "Mostra meno"+ "value" : "Mostra altro…"}},"ja" : {"stringUnit" : {"state" : "translated",- "value" : "表示を減らす"+ "value" : "表示を増やす…"}},"ko" : {"stringUnit" : {"state" : "translated",- "value" : "간략히 보기"- }- },- "nl" : {- "stringUnit" : {- "state" : "translated",- "value" : "Toon minder"- }- },- "pl" : {- "stringUnit" : {- "state" : "translated",- "value" : "Pokaż mniej"- }- },- "pt" : {- "stringUnit" : {- "state" : "translated",- "value" : "Mostrar Menos"- }- },- "ro" : {- "stringUnit" : {- "state" : "translated",- "value" : "Afișați mai puțin"- }- },- "ru" : {- "stringUnit" : {- "state" : "translated",- "value" : "Показать меньше"- }- },- "sv" : {- "stringUnit" : {- "state" : "translated",- "value" : "Visa mindre"- }- },- "tr" : {- "stringUnit" : {- "state" : "translated",- "value" : "Daha Az Göster"- }- },- "uk" : {- "stringUnit" : {- "state" : "translated",- "value" : "Показати менше"- }- },- "zh-Hans" : {- "stringUnit" : {- "state" : "translated",- "value" : "更少内容"- }- },- "zh-Hant" : {- "stringUnit" : {- "state" : "translated",- "value" : "顯示較少"- }- }- }- },- "Show More" : {- "localizations" : {- "cs" : {- "stringUnit" : {- "state" : "translated",- "value" : "Zobrazit více"- }- },- "de" : {- "stringUnit" : {- "state" : "translated",- "value" : "Mehr anzeigen"- }- },- "es" : {- "stringUnit" : {- "state" : "translated",- "value" : "Mostrar más"- }- },- "fr" : {- "stringUnit" : {- "state" : "translated",- "value" : "En afficher plus"- }- },- "it" : {- "stringUnit" : {- "state" : "translated",- "value" : "Mostra altro"- }- },- "ja" : {- "stringUnit" : {- "state" : "translated",- "value" : "表示を増やす"- }- },- "ko" : {- "stringUnit" : {- "state" : "translated",- "value" : "더 보기"+ "value" : "더 보기…"}},"nl" : {"stringUnit" : {"state" : "translated",- "value" : "Toon meer"+ "value" : "Toon meer…"}},"pl" : {"stringUnit" : {"state" : "translated",- "value" : "Pokaż więcej"+ "value" : "Pokaż więcej…"}},"pt" : {"stringUnit" : {"state" : "translated",- "value" : "Mostrar Mais"+ "value" : "Mostrar Mais…"}},"ro" : {"stringUnit" : {"state" : "translated",- "value" : "Afișați mai mult"+ "value" : "Afișați mai mult…"}},"ru" : {"stringUnit" : {"state" : "translated",- "value" : "Показать еще"+ "value" : "Показать еще…"}},"sv" : {"stringUnit" : {"state" : "translated",- "value" : "Visa mer"+ "value" : "Visa mer…"}},"tr" : {"stringUnit" : {"state" : "translated",- "value" : "Daha Fazla Göster"+ "value" : "Daha Fazla Göster…"}},"uk" : {"stringUnit" : {"state" : "translated",- "value" : "Показати більше"+ "value" : "Показати більше…"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "更多内容"+ "value" : "更多内容…"}},"zh-Hant" : {"stringUnit" : {"state" : "translated",- "value" : "顯示較多"+ "value" : "顯示較多⋯"}}}diff --git a/Peel/Views/AppHeader.swift b/Peel/Views/AppHeader.swiftindex 10569bf8..1d37e1b1 100644--- a/Peel/Views/AppHeader.swift+++ b/Peel/Views/AppHeader.swift@@ -9,8 +9,8 @@ struct AppHeader<Actions: View>: View {let app: InstalledApplet updateStatus: UpdateStatus?let isCheckingForUpdates: Bool- /// The version a waiting update would bring. The caller passes it only when `AppLibrary.hasUpdate` is true.- var waitingVersion: String?+ /// True when `AppLibrary.hasUpdate` is, since the page then shows the update in a panel of its own.+ var hasWaitingUpdate = falsevar lastCheck: Date?let cannotCheck: CannotCheckvar total: SizeTotal?@@ -37,11 +37,10 @@ struct AppHeader<Actions: View>: View {.accessibilityLabel(Text("\(total.text) can be moved to the Trash"))}}- .padding(.bottom, 8)}- /// The line under the name: the bundle identifier, the installed version, and where an update would take- /// it, then badges for anything unusual about the app and for the update status. It wraps when it doesn't fit.+ /// The line under the name: the bundle identifier and the installed version, then badges for anything unusual+ /// about the app and for the update status. It wraps when it doesn't fit.private var identity: some View {FlowLayout(spacing: 6) {HStack(spacing: 5) {@@ -56,16 +55,7 @@ struct AppHeader<Actions: View>: View {Text(verbatim: "·").accessibilityHidden(true)}- if let waitingVersion {- StatusLabel(- title: Text(verbatim: "\(version) → \(waitingVersion)"),- systemImage: "arrow.down.circle",- tint: .accentColor- )- .accessibilityLabel(Text("\(version), update available: \(waitingVersion)"))- } else {- Text(verbatim: version)- }+ Text(verbatim: version)}}.font(.subheadline.monospaced())@@ -95,9 +85,7 @@ struct AppHeader<Actions: View>: View {detail: Text("macOS keeps this app, so it stays where it is."))}- // A waiting update already shows beside the version, so the status badge shows only when- // there is none.- if waitingVersion == nil {+ if !hasWaitingUpdate {UpdateStatusBadge(app: app,status: updateStatus,@@ -107,6 +95,6 @@ struct AppHeader<Actions: View>: View {)}}- .motion(value: waitingVersion)+ .motion(value: hasWaitingUpdate)}}diff --git a/Peel/Views/AppPageHeader.swift b/Peel/Views/AppPageHeader.swiftindex 10359a58..44f8a144 100644--- a/Peel/Views/AppPageHeader.swift+++ b/Peel/Views/AppPageHeader.swift@@ -24,18 +24,22 @@ struct AppPageHeader: View {let quittingToUpgrade: QuitBeforeRemovingvar body: some View {- AppHeader(- app: plan.app,- updateStatus: library.shownUpdateStatus(of: plan.app),- isCheckingForUpdates: library.appsCheckingForUpdates.contains(plan.app.id),- waitingVersion: waitingVersion == nil ? nil : library.updateStatuses[plan.app.id]?.displayVersion,- lastCheck: library.lastUpdateChecks[plan.app.id],- cannotCheck: library.whyItCannotCheck(plan.app),- total: plan.total,- sharesStorage: plan.appSharesStorage- ) {- appActions+ VStack(alignment: .leading, spacing: 16) {+ AppHeader(+ app: plan.app,+ updateStatus: library.shownUpdateStatus(of: plan.app),+ isCheckingForUpdates: library.appsCheckingForUpdates.contains(plan.app.id),+ hasWaitingUpdate: waitingVersion != nil,+ lastCheck: library.lastUpdateChecks[plan.app.id],+ cannotCheck: library.whyItCannotCheck(plan.app),+ total: plan.total,+ sharesStorage: plan.appSharesStorage+ ) {+ appActions+ }+ updatePanel}+ .padding(.bottom, 8)}/// The version an update would bring. Nil when there is no update, or when the user muted this app or@@ -44,18 +48,11 @@ struct AppPageHeader: View {library.hasUpdate(plan.app) ? library.updateStatuses[plan.app.id]?.version : nil}- private var updateSource: UpdateSource? {- library.updateStatuses[plan.app.id]?.source- }-- /// What can be done to the app without removing it: update it, open its maker's uninstaller, or reset it.- /// Less common actions, such as the release notes or muting updates, sit in the More menu.+ /// What can be done to the app without removing it, its update aside: open its maker's uninstaller, or reset+ /// it. Less common actions, such as the release notes or muting updates, sit in the More menu.private var appActions: some View {VStack(alignment: .leading, spacing: 6) {FlowLayout {- if let version = waitingVersion, let source = updateSource {- updateAction(for: source, version: version)- }if let uninstaller = plan.vendorUninstaller {Button("Open Uninstaller", systemImage: "arrow.up.forward.app") {NSWorkspace.shared.open(uninstaller)@@ -75,37 +72,41 @@ struct AppPageHeader: View {moreMenu}.disabled(isRemoving)- if let upgrade = library.upgrade(of: plan.app) {+ // An upgrade that brought the app up to date leaves no panel to say how it went.+ if waitingVersion == nil, let upgrade = library.upgrade(of: plan.app) {outcome(of: upgrade)- } else if let source = updateSource, waitingVersion != nil {- Text(updateExplanation(for: source)).font(.caption).foregroundStyle(.secondary)}if let privacyReset {outcome(of: privacyReset)}- if let releaseNotesBox {- releaseNotesBox- }}}- /// What is new in the update that waits, or where the app says it. The store's page is already the App Store- /// button, and a cask's homepage is offered as what it is.- private var releaseNotesBox: ReleaseNotesBox? {- guard waitingVersion != nil, let status = library.updateStatuses[plan.app.id],- let version = status.displayVersion- else { return nil }- let notes = library.releaseNotes(of: plan.app)- let link = status.source == .appStore ? nil : status.releaseNotes- guard notes != nil || link != nil else { return nil }- return ReleaseNotesBox(- version: version,- notes: notes,- link: link,- linkTitle: status.source == .homebrew ? "Homepage" : "Release Notes"- )+ /// The update that waits, how to get it, and what is new in it. The store's page is already the App Store button,+ /// and a cask's homepage is offered as what it is.+ @ViewBuilder+ private var updatePanel: some View {+ if let version = waitingVersion, let status = library.updateStatuses[plan.app.id],+ let source = status.source, let shown = status.displayVersion {+ UpdatePanel(+ version: shown,+ notes: library.releaseNotes(of: plan.app),+ link: source == .appStore ? nil : status.releaseNotes.map {+ ReleaseNotesLink(url: $0, title: source == .homebrew ? "Homepage" : "Release Notes")+ }+ ) {+ if let upgrade = library.upgrade(of: plan.app) {+ outcome(of: upgrade)+ } else {+ Text(updateExplanation(for: source))+ }+ } action: {+ updateAction(for: source, version: version)+ .disabled(isRemoving)+ }+ }}private var moreMenu: some View {@@ -268,23 +269,19 @@ struct AppPageHeader: View {@ViewBuilderprivate func outcome(of upgrade: AppLibrary.Upgrade) -> some View {- Group {- if upgrade.succeeded {- StatusLabel(- title: upgrade.app.version.map { Text("Now on \($0).") } ?? Text("Homebrew finished the upgrade."),- systemImage: "checkmark.circle.fill",- tint: .green- )- } else {- StatusLabel(- title: Text("Homebrew couldn’t finish the upgrade."),- systemImage: "exclamationmark.triangle.fill",- tint: .red- )- }+ if upgrade.succeeded {+ StatusLabel(+ title: upgrade.app.version.map { Text("Now on \($0).") } ?? Text("Homebrew finished the upgrade."),+ systemImage: "checkmark.circle.fill",+ tint: .green+ )+ } else {+ StatusLabel(+ title: Text("Homebrew couldn’t finish the upgrade."),+ systemImage: "exclamationmark.triangle.fill",+ tint: .red+ )}- .font(.caption)- .foregroundStyle(.secondary)}@ViewBuilderdiff --git a/Peel/Views/Homebrew/HomebrewDetailView.swift b/Peel/Views/Homebrew/HomebrewDetailView.swiftindex c4db533a..075de639 100644--- a/Peel/Views/Homebrew/HomebrewDetailView.swift+++ b/Peel/Views/Homebrew/HomebrewDetailView.swift@@ -205,7 +205,7 @@ struct HomebrewDetailView: View {if let (version, notes) = caskNotes {Section {- ReleaseNotesView(notes: notes)+ ReleaseNotesView(notes: notes, version: version)} header: {Text("What’s New in \(version)")}diff --git a/Peel/Views/ReleaseNotesView.swift b/Peel/Views/ReleaseNotesView.swiftindex d8874769..1b364563 100644--- a/Peel/Views/ReleaseNotesView.swift+++ b/Peel/Views/ReleaseNotesView.swift@@ -1,25 +1,36 @@import PeelCoreimport SwiftUI-/// What is new in a waiting update, as its notes say it: headings, paragraphs and lists, cut to a few lines until-/// the person asks for the rest.+/// What is new in a waiting update, as its notes say it: headings, paragraphs and lists, cut to a few lines with the+/// rest in a popover, so long notes never make the page longer.struct ReleaseNotesView: View {let notes: ReleaseNotes+ /// The version the notes are for, which the popover is titled with.+ let version: String+ /// Shown at the end of the notes, beside Show More when they are cut.+ var link: ReleaseNotesLink?@State private var blocks: [ReleaseNotes.Block] = []- @State private var isLong = false- @State private var isExpanded = false+ @State private var isTall = false+ @State private var isShowingAll = falsenonisolated private static let shortHeight: CGFloat = 132+ /// More blocks than the cut ever shows, since each is at least a line: only these are built on the page, so a long+ /// changelog doesn't put hundreds of views there.+ private static let shownBlocks = 10++ private var isLong: Bool {+ isTall || blocks.count > Self.shownBlocks+ }var body: some View {VStack(alignment: .leading, spacing: 6) {- content+ ReleaseNotesBlocks(blocks: blocks.prefix(Self.shownBlocks)).fixedSize(horizontal: false, vertical: true)- .onGeometryChange(for: Bool.self) { $0.size.height > Self.shortHeight } action: { isLong = $0 }- .frame(maxHeight: isLong && !isExpanded ? Self.shortHeight : nil, alignment: .top)+ .onGeometryChange(for: Bool.self) { $0.size.height > Self.shortHeight } action: { isTall = $0 }+ .frame(maxHeight: isLong ? Self.shortHeight : nil, alignment: .top).clipped().mask {- if isLong && !isExpanded {+ if isLong {VStack(spacing: 0) {Color.blackLinearGradient(colors: [.black, .clear], startPoint: .top, endPoint: .bottom)@@ -29,85 +40,107 @@ struct ReleaseNotesView: View {Color.black}}- if isLong {- Button {- isExpanded.toggle()- } label: {- Text(isExpanded ? "Show Less" : "Show More")- .minimumTarget()+ if isLong || link != nil {+ HStack(alignment: .firstTextBaseline, spacing: 8) {+ if isLong {+ Button {+ isShowingAll = true+ } label: {+ Text("Show More\u{2026}")+ .minimumTarget()+ }+ .buttonStyle(.link)+ // A popover, not a sheet: a sheet dims the window, which makes SwiftUI measure every row on+ // screen again as it opens and again as it closes.+ .popover(isPresented: $isShowingAll, arrowEdge: .bottom) {+ AllReleaseNotes(version: version, blocks: blocks)+ }+ }+ Spacer(minLength: 8)+ link}- .buttonStyle(.link)}}.font(.callout)- .motion(value: isExpanded)// Reading HTML takes a moment, so it is read away from the page and only again when the notes change..task(id: notes) {let notes = notesblocks = await Task.detached { notes.blocks }.value}}+}- private var content: some View {- VStack(alignment: .leading, spacing: 6) {- ForEach(Array(blocks.enumerated()), id: \.offset) { _, block in- switch block {- case .heading(let words):- Text(words)- .fontWeight(.semibold)- .accessibilityAddTraits(.isHeader)- case .paragraph(let words):- Text(words)- case .item(let words, let depth):- HStack(alignment: .firstTextBaseline, spacing: 6) {- Text(verbatim: "•")- .accessibilityHidden(true)- Text(words)- }- .padding(.leading, CGFloat(depth) * 14)- }+/// Blocks of an update's notes, from the top. In a scroll view they are lazy, built as they come into sight.+private struct ReleaseNotesBlocks: View {+ let blocks: ArraySlice<ReleaseNotes.Block>+ var isLazy = false++ var body: some View {+ Group {+ if isLazy {+ LazyVStack(alignment: .leading, spacing: 6) { rows }+ } else {+ VStack(alignment: .leading, spacing: 6) { rows }}}.textSelection(.enabled).frame(maxWidth: .infinity, alignment: .leading)}++ private var rows: some View {+ ForEach(blocks.indices, id: \.self) { index in+ switch blocks[index] {+ case .heading(let words):+ Text(words)+ .fontWeight(.semibold)+ .accessibilityAddTraits(.isHeader)+ case .paragraph(let words):+ Text(words)+ case .item(let words, let depth):+ HStack(alignment: .firstTextBaseline, spacing: 6) {+ Text(verbatim: "•")+ .accessibilityHidden(true)+ Text(words)+ }+ .padding(.leading, CGFloat(depth) * 14)+ }+ }+ }}-/// The panel an app's page shows under its update: what is new in the version that waits, or, when no notes came-/// with the update, where the app says it.-struct ReleaseNotesBox: View {+/// All of an update's notes, in a popover as tall as they are up to a limit, past which they scroll. The link to+/// them stays beside Show More, under the notes the page shows.+private struct AllReleaseNotes: View {let version: String- let notes: ReleaseNotes?- let link: URL?- let linkTitle: LocalizedStringResource+ let blocks: [ReleaseNotes.Block]var body: some View {- VStack(alignment: .leading, spacing: 8) {- HStack(alignment: .firstTextBaseline, spacing: 8) {- Text("What’s New in \(version)")- .font(.callout.weight(.semibold))- .accessibilityAddTraits(.isHeader)- Spacer(minLength: 8)- if let link {- Link(destination: link) {- Text(linkTitle)- .minimumTarget()- }- .font(.callout)- .help(Text(verbatim: link.absoluteString))- }- }- if let notes {- ReleaseNotesView(notes: notes)- } else {- Text("This update came with no notes.")- .font(.callout)- .foregroundStyle(.secondary)+ VStack(alignment: .leading, spacing: 10) {+ Text("What’s New in \(version)")+ .font(.headline)+ .accessibilityAddTraits(.isHeader)+ ScrollView {+ ReleaseNotesBlocks(blocks: blocks[...], isLazy: true)}+ .frame(maxHeight: 400)+ .fixedSize(horizontal: false, vertical: true)}- .padding(.horizontal, 12)- .padding(.vertical, 10)- .frame(maxWidth: .infinity, alignment: .leading)- .background(.quaternary, in: .rect(cornerRadius: 8))+ .padding(14)+ .frame(width: 440)+ }+}++/// Where an update's notes are on the web: the app's own page of release notes, or a cask's homepage.+struct ReleaseNotesLink: View {+ let url: URL+ let title: LocalizedStringResource++ var body: some View {+ Link(destination: url) {+ Text(title)+ .minimumTarget()+ }+ .fixedSize()+ .help(Text(verbatim: url.absoluteString))}}diff --git a/Peel/Views/UpdatePanel.swift b/Peel/Views/UpdatePanel.swiftnew file mode 100644index 00000000..f56cc6ed--- /dev/null+++ b/Peel/Views/UpdatePanel.swift@@ -0,0 +1,85 @@+import PeelCore+import SwiftUI++/// The update an app waits for, in a panel of its own under the app: the version it brings, how to get it, and what+/// is new in it or where the app says so.+struct UpdatePanel<Detail: View, Action: View>: View {+ let version: String+ let notes: ReleaseNotes?+ let link: ReleaseNotesLink?+ @ViewBuilder let detail: Detail+ @ViewBuilder let action: Action++ /// The narrowest the words may get beside the button. With less room, the button moves under the words.+ private static var wordsFloor: CGFloat { 200 }++ var body: some View {+ HStack(alignment: .words, spacing: 12) {+ mark+ VStack(alignment: .leading, spacing: 12) {+ ViewThatFits(in: .horizontal) {+ HStack(spacing: 12) {+ words+ .frame(+ minWidth: Self.wordsFloor,+ idealWidth: Self.wordsFloor,+ maxWidth: .infinity,+ alignment: .leading+ )+ action+ }+ VStack(alignment: .leading, spacing: 10) {+ words+ action+ }+ .frame(maxWidth: .infinity, alignment: .leading)+ }+ if let notes {+ Divider()+ ReleaseNotesView(notes: notes, version: version, link: link)+ } else if let link {+ HStack(alignment: .firstTextBaseline, spacing: 8) {+ Text("This update came with no notes.")+ .foregroundStyle(.secondary)+ Spacer(minLength: 8)+ link+ }+ .font(.callout)+ }+ }+ }+ .padding(12)+ .frame(maxWidth: .infinity, alignment: .leading)+ .background(.quaternary, in: .rect(cornerRadius: 8))+ }++ private var mark: some View {+ Image(systemName: "arrow.down.circle.fill")+ .font(.title)+ .foregroundStyle(Color.accentColor)+ .accessibilityHidden(true)+ }++ private var words: some View {+ VStack(alignment: .leading, spacing: 3) {+ Text("Update to \(version)")+ .font(.headline)+ .accessibilityAddTraits(.isHeader)+ detail+ .font(.callout)+ .foregroundStyle(.secondary)+ }+ .alignmentGuide(.words) { $0[VerticalAlignment.center] }+ }+}++extension VerticalAlignment {+ /// The middle of an update panel's title and the line under it, which its mark lines up with.+ private enum Words: AlignmentID {+ static func defaultValue(in context: ViewDimensions) -> CGFloat {+ context[VerticalAlignment.center]+ }+ }++ fileprivate static let words = VerticalAlignment(Words.self)+}