diff --git a/Xcodes/Backend/AppState+Install.swift b/Xcodes/Backend/AppState+Install.swift index 4a47a20..2d07bb2 100644 --- a/Xcodes/Backend/AppState+Install.swift +++ b/Xcodes/Backend/AppState+Install.swift @@ -411,7 +411,7 @@ public enum InstallationError: LocalizedError, Equatable { case .missingSudoerPassword: return "Missing password. Please try again." case let .unavailableVersion(version): - return "Could not find version \(version.xcodeDescription)." + return "Could not find version \(version.appleDescription)." case .noNonPrereleaseVersionAvailable: return "No non-prerelease versions available." case .noPrereleaseVersionAvailable: @@ -419,11 +419,11 @@ public enum InstallationError: LocalizedError, Equatable { case .missingUsernameOrPassword: return "Missing username or a password. Please try again." case let .versionAlreadyInstalled(installedXcode): - return "\(installedXcode.version.xcodeDescription) is already installed at \(installedXcode.path)" + return "\(installedXcode.version.appleDescription) is already installed at \(installedXcode.path)" case let .invalidVersion(version): return "\(version) is not a valid version number." case let .versionNotInstalled(version): - return "\(version.xcodeDescription) is not installed." + return "\(version.appleDescription) is not installed." } } } diff --git a/Xcodes/Backend/Version+Xcode.swift b/Xcodes/Backend/Version+Xcode.swift index 02e254c..77879a5 100644 --- a/Xcodes/Backend/Version+Xcode.swift +++ b/Xcodes/Backend/Version+Xcode.swift @@ -38,7 +38,12 @@ public extension Version { self = Version(major: major, minor: minor, patch: patch, prereleaseIdentifiers: prereleaseIdentifiers, buildMetadataIdentifiers: [buildMetadataIdentifier].compactMap { $0 }) } - var xcodeDescription: String { + /// The intent here is to match Apple's marketing version + /// + /// Only show the patch number if it's not 0 + /// Format prerelease identifiers + /// Don't include build identifiers + var appleDescription: String { var base = "\(major).\(minor)" if patch != 0 { base += ".\(patch)" @@ -47,10 +52,6 @@ public extension Version { base += " " + prereleaseIdentifiers .map { $0.replacingOccurrences(of: "-", with: " ").capitalized.replacingOccurrences(of: "Gm", with: "GM") } .joined(separator: " ") - - if !buildMetadataIdentifiers.isEmpty { - base += " (\(buildMetadataIdentifiers.joined(separator: " ")))" - } } return base } diff --git a/Xcodes/Backend/Xcode.swift b/Xcodes/Backend/Xcode.swift index b662519..481eb78 100644 --- a/Xcodes/Backend/Xcode.swift +++ b/Xcodes/Backend/Xcode.swift @@ -37,6 +37,6 @@ struct Xcode: Identifiable, CustomStringConvertible { var id: Version { version } var description: String { - version.xcodeDescription + version.appleDescription } } diff --git a/Xcodes/Frontend/XcodeList/InfoPane.swift b/Xcodes/Frontend/XcodeList/InfoPane.swift index bc40ca4..2b4e73d 100644 --- a/Xcodes/Frontend/XcodeList/InfoPane.swift +++ b/Xcodes/Frontend/XcodeList/InfoPane.swift @@ -17,7 +17,7 @@ struct InfoPane: View { icon(for: xcode) VStack(alignment: .leading) { - Text("Xcode \(xcode.description)") + Text(verbatim: "Xcode \(xcode.description) (\(xcode.version.buildMetadataIdentifiers.joined(separator: " ")))") .font(.title) .frame(maxWidth: .infinity, alignment: .leading) diff --git a/Xcodes/Frontend/XcodeList/XcodeListViewRow.swift b/Xcodes/Frontend/XcodeList/XcodeListViewRow.swift index 5a3b4c1..9a6dff0 100644 --- a/Xcodes/Frontend/XcodeList/XcodeListViewRow.swift +++ b/Xcodes/Frontend/XcodeList/XcodeListViewRow.swift @@ -11,8 +11,8 @@ struct XcodeListViewRow: View { HStack { appIconView(for: xcode) - VStack(alignment: .leading) { - Text(xcode.description) + VStack(alignment: .leading) { + Text(verbatim: "\(xcode.description) (\(xcode.version.buildMetadataIdentifiers.joined(separator: " ")))") .font(.body) if case let .installed(path) = xcode.installState {