diff --git a/Xcodes/Frontend/InfoPane/PlatformsView.swift b/Xcodes/Frontend/InfoPane/PlatformsView.swift index 6fe2134..ea268c1 100644 --- a/Xcodes/Frontend/InfoPane/PlatformsView.swift +++ b/Xcodes/Frontend/InfoPane/PlatformsView.swift @@ -11,7 +11,7 @@ import XcodesKit struct PlatformsView: View { @EnvironmentObject var appState: AppState - @AppStorage("selectedRuntimeArchitecture") private var selectedRuntimeArchitecture: Architecture = .arm64 + @AppStorage("selectedRuntimeArchitecture") private var selectedVariant: ArchitectureVariant = .universal let xcode: Xcode @@ -22,7 +22,9 @@ struct PlatformsView: View { appState.downloadableRuntimes.filter { $0.sdkBuildUpdate?.contains(sdkBuild) ?? false && ($0.architectures?.isEmpty ?? true || - $0.architectures?.contains(selectedRuntimeArchitecture) ?? false) + ($0.architectures?.isUniversal ?? false && selectedVariant == .universal) || + ($0.architectures?.isAppleSilicon ?? false && selectedVariant == .appleSilicon) + ) } } @@ -35,8 +37,8 @@ struct PlatformsView: View { .frame(maxWidth: .infinity, alignment: .leading) if !architectures.isEmpty { Spacer() - Picker("Architecture", selection: $selectedRuntimeArchitecture) { - ForEach(Architecture.allCases, id: \.self) { arch in + Picker("Architecture", selection: $selectedVariant) { + ForEach(ArchitectureVariant.allCases, id: \.self) { arch in Label(arch.displayString, systemImage: arch.iconName) .tag(arch) } @@ -73,6 +75,7 @@ struct PlatformsView: View { ForEach(runtime.architectures ?? [], id: \.self) { architecture in TagView(text: architecture.displayString) } + pathIfAvailable(xcode: xcode, runtime: runtime) if runtime.installState == .notInstalled { diff --git a/Xcodes/Resources/Licenses.rtf b/Xcodes/Resources/Licenses.rtf index 152e9bf..cef9fff 100644 --- a/Xcodes/Resources/Licenses.rtf +++ b/Xcodes/Resources/Licenses.rtf @@ -1,4 +1,4 @@ -{\rtf1\ansi\ansicpg1252\cocoartf2822 +{\rtf1\ansi\ansicpg1252\cocoartf2865 \cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fnil\fcharset0 .SFNS-Regular;} {\colortbl;\red255\green255\blue255;} {\*\expandedcolortbl;;} diff --git a/Xcodes/Resources/Localizable.xcstrings b/Xcodes/Resources/Localizable.xcstrings index e6cc898..ad97936 100644 --- a/Xcodes/Resources/Localizable.xcstrings +++ b/Xcodes/Resources/Localizable.xcstrings @@ -4819,6 +4819,9 @@ } } } + }, + "Architecture" : { + }, "Authenticating" : { "extractionState" : "manual", @@ -5683,6 +5686,9 @@ } } } + }, + "Category" : { + }, "Change" : { "localizations" : { @@ -9239,6 +9245,9 @@ } } } + }, + "FilterArchitecturesDescription" : { + }, "FilterAvailableDescription" : { "localizations" : { @@ -13462,6 +13471,9 @@ } } } + }, + "Installed Only" : { + }, "InstallHelper" : { "localizations" : { diff --git a/Xcodes/XcodesKit/Package.swift b/Xcodes/XcodesKit/Package.swift index 81447ab..abb461f 100644 --- a/Xcodes/XcodesKit/Package.swift +++ b/Xcodes/XcodesKit/Package.swift @@ -5,7 +5,7 @@ import PackageDescription let package = Package( name: "XcodesKit", - platforms: [.macOS(.v11)], + platforms: [.macOS(.v13)], products: [ // Products define the executables and libraries a package produces, and make them visible to other packages. .library( diff --git a/Xcodes/XcodesKit/Sources/XcodesKit/Models/XcodeReleases/Architecture.swift b/Xcodes/XcodesKit/Sources/XcodesKit/Models/XcodeReleases/Architecture.swift index 834ebee..607d7f8 100644 --- a/Xcodes/XcodesKit/Sources/XcodesKit/Models/XcodeReleases/Architecture.swift +++ b/Xcodes/XcodesKit/Sources/XcodesKit/Models/XcodeReleases/Architecture.swift @@ -35,8 +35,37 @@ public enum Architecture: String, Codable, Equatable, Hashable, Identifiable, Ca } } +public enum ArchitectureVariant: String, Codable, Equatable, Hashable, Identifiable, CaseIterable { + public var id: Self { self } + + case universal + case appleSilicon + + public var displayString: String { + switch self { + case .appleSilicon: + return "Apple Silicon" + case .universal: + return "Universal" + } + } + + public var iconName: String { + switch self { + case .appleSilicon: + return "m4.button.horizontal" + case .universal: + return "cpu.fill" + } + } +} + extension Array where Element == Architecture { public var isAppleSilicon: Bool { self == [.arm64] } + + public var isUniversal: Bool { + self.contains([.arm64, .x86_64]) + } }