From de60382824a6e5ff5e31fa6592b8f56ccbf63b02 Mon Sep 17 00:00:00 2001 From: Jon Parise Date: Fri, 15 Nov 2024 22:43:21 -0500 Subject: [PATCH] macos: further simplify using a @ViewBuilder --- macos/Sources/Features/About/AboutView.swift | 26 +++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/macos/Sources/Features/About/AboutView.swift b/macos/Sources/Features/About/AboutView.swift index 0b0dcc75f..efe1f31bb 100644 --- a/macos/Sources/Features/About/AboutView.swift +++ b/macos/Sources/Features/About/AboutView.swift @@ -116,6 +116,15 @@ struct AboutView: View { self.url = url } + @ViewBuilder private var textView: some View { + Text(text) + .frame(width: 125, alignment: .leading) + .padding(.leading, 2) + .tint(.secondary) + .opacity(0.8) + .monospaced() + } + var body: some View { HStack(spacing: 4) { Text(label) @@ -123,10 +132,10 @@ struct AboutView: View { .padding(.trailing, 2) if let url { Link(destination: url) { - PropertyText(text: text) + textView } } else { - PropertyText(text: text) + textView } } .font(.callout) @@ -134,19 +143,6 @@ struct AboutView: View { .frame(maxWidth: .infinity) } } - - private struct PropertyText: View { - let text: String - - var body: some View { - Text(text) - .frame(width: 125, alignment: .leading) - .padding(.leading, 2) - .tint(.secondary) - .opacity(0.8) - .monospaced() - } - } } struct AboutView_Previews: PreviewProvider {