From ef646b7b88e2df967d9c115fb686d85c960c1e6f Mon Sep 17 00:00:00 2001 From: Brandon Evans Date: Thu, 4 Feb 2021 21:15:41 -0700 Subject: [PATCH] Add identical builds indicator to XcodeListViewRow --- Xcodes/Frontend/XcodeList/XcodeListView.swift | 1 + Xcodes/Frontend/XcodeList/XcodeListViewRow.swift | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Xcodes/Frontend/XcodeList/XcodeListView.swift b/Xcodes/Frontend/XcodeList/XcodeListView.swift index b790988..4905e78 100644 --- a/Xcodes/Frontend/XcodeList/XcodeListView.swift +++ b/Xcodes/Frontend/XcodeList/XcodeListView.swift @@ -44,6 +44,7 @@ struct XcodeListView_Previews: PreviewProvider { .environmentObject({ () -> AppState in let a = AppState() a.allXcodes = [ + Xcode(version: Version("12.0.0+1234A")!, identicalBuilds: [Version("12.0.0+1234A")!, Version("12.0.0-RC+1234A")!], installState: .installed(Path("/Applications/Xcode-12.3.0.app")!), selected: false, icon: nil), Xcode(version: Version("12.3.0")!, installState: .installed(Path("/Applications/Xcode-12.3.0.app")!), selected: true, icon: nil), Xcode(version: Version("12.2.0")!, installState: .notInstalled, selected: false, icon: nil), Xcode(version: Version("12.1.0")!, installState: .installing(.downloading(progress: configure(Progress(totalUnitCount: 100)) { $0.completedUnitCount = 40 })), selected: false, icon: nil), diff --git a/Xcodes/Frontend/XcodeList/XcodeListViewRow.swift b/Xcodes/Frontend/XcodeList/XcodeListViewRow.swift index 68c4c3d..723d690 100644 --- a/Xcodes/Frontend/XcodeList/XcodeListViewRow.swift +++ b/Xcodes/Frontend/XcodeList/XcodeListViewRow.swift @@ -12,8 +12,19 @@ struct XcodeListViewRow: View { appIconView(for: xcode) VStack(alignment: .leading) { - Text(verbatim: "\(xcode.description) \(xcode.version.buildMetadataIdentifiersDisplay)") - .font(.body) + HStack { + Text(verbatim: "\(xcode.description) \(xcode.version.buildMetadataIdentifiersDisplay)") + .font(.body) + + if !xcode.identicalBuilds.isEmpty { + Image(systemName: "square.fill.on.square.fill") + .font(.subheadline) + .foregroundColor(.secondary) + .accessibility(label: Text("Identical Builds")) + .accessibility(value: Text(xcode.identicalBuilds.map(\.appleDescription).joined(separator: ", "))) + .help("Sometimes a prerelease and release version are the exact same build. Xcodes will automatically display these versions together.") + } + } if case let .installed(path) = xcode.installState { Text(verbatim: path.string)