Add identical builds indicator to XcodeListViewRow

This commit is contained in:
Brandon Evans 2021-02-04 21:15:41 -07:00
parent 70872f441a
commit ef646b7b88
No known key found for this signature in database
GPG key ID: D58A4B8DB64F8E93
2 changed files with 14 additions and 2 deletions

View file

@ -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),

View file

@ -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)