Skip to content

Commit fc50db1

Browse files
committed
fix how platforms are architecture filtered
1 parent 6cf9647 commit fc50db1

File tree

5 files changed

+50
-6
lines changed

5 files changed

+50
-6
lines changed

Xcodes/Frontend/InfoPane/PlatformsView.swift

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import XcodesKit
1111

1212
struct PlatformsView: View {
1313
@EnvironmentObject var appState: AppState
14-
@AppStorage("selectedRuntimeArchitecture") private var selectedRuntimeArchitecture: Architecture = .arm64
14+
@AppStorage("selectedRuntimeArchitecture") private var selectedVariant: ArchitectureVariant = .universal
1515

1616
let xcode: Xcode
1717

@@ -22,7 +22,9 @@ struct PlatformsView: View {
2222
appState.downloadableRuntimes.filter {
2323
$0.sdkBuildUpdate?.contains(sdkBuild) ?? false &&
2424
($0.architectures?.isEmpty ?? true ||
25-
$0.architectures?.contains(selectedRuntimeArchitecture) ?? false)
25+
($0.architectures?.isUniversal ?? false && selectedVariant == .universal) ||
26+
($0.architectures?.isAppleSilicon ?? false && selectedVariant == .appleSilicon)
27+
)
2628
}
2729
}
2830

@@ -35,8 +37,8 @@ struct PlatformsView: View {
3537
.frame(maxWidth: .infinity, alignment: .leading)
3638
if !architectures.isEmpty {
3739
Spacer()
38-
Picker("Architecture", selection: $selectedRuntimeArchitecture) {
39-
ForEach(Architecture.allCases, id: \.self) { arch in
40+
Picker("Architecture", selection: $selectedVariant) {
41+
ForEach(ArchitectureVariant.allCases, id: \.self) { arch in
4042
Label(arch.displayString, systemImage: arch.iconName)
4143
.tag(arch)
4244
}
@@ -73,6 +75,7 @@ struct PlatformsView: View {
7375
ForEach(runtime.architectures ?? [], id: \.self) { architecture in
7476
TagView(text: architecture.displayString)
7577
}
78+
7679
pathIfAvailable(xcode: xcode, runtime: runtime)
7780

7881
if runtime.installState == .notInstalled {

Xcodes/Resources/Licenses.rtf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{\rtf1\ansi\ansicpg1252\cocoartf2822
1+
{\rtf1\ansi\ansicpg1252\cocoartf2865
22
\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fnil\fcharset0 .SFNS-Regular;}
33
{\colortbl;\red255\green255\blue255;}
44
{\*\expandedcolortbl;;}

Xcodes/Resources/Localizable.xcstrings

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4819,6 +4819,9 @@
48194819
}
48204820
}
48214821
}
4822+
},
4823+
"Architecture" : {
4824+
48224825
},
48234826
"Authenticating" : {
48244827
"extractionState" : "manual",
@@ -5683,6 +5686,9 @@
56835686
}
56845687
}
56855688
}
5689+
},
5690+
"Category" : {
5691+
56865692
},
56875693
"Change" : {
56885694
"localizations" : {
@@ -9239,6 +9245,9 @@
92399245
}
92409246
}
92419247
}
9248+
},
9249+
"FilterArchitecturesDescription" : {
9250+
92429251
},
92439252
"FilterAvailableDescription" : {
92449253
"localizations" : {
@@ -13462,6 +13471,9 @@
1346213471
}
1346313472
}
1346413473
}
13474+
},
13475+
"Installed Only" : {
13476+
1346513477
},
1346613478
"InstallHelper" : {
1346713479
"localizations" : {

Xcodes/XcodesKit/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import PackageDescription
55

66
let package = Package(
77
name: "XcodesKit",
8-
platforms: [.macOS(.v11)],
8+
platforms: [.macOS(.v13)],
99
products: [
1010
// Products define the executables and libraries a package produces, and make them visible to other packages.
1111
.library(

Xcodes/XcodesKit/Sources/XcodesKit/Models/XcodeReleases/Architecture.swift

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,37 @@ public enum Architecture: String, Codable, Equatable, Hashable, Identifiable, Ca
3535
}
3636
}
3737

38+
public enum ArchitectureVariant: String, Codable, Equatable, Hashable, Identifiable, CaseIterable {
39+
public var id: Self { self }
40+
41+
case universal
42+
case appleSilicon
43+
44+
public var displayString: String {
45+
switch self {
46+
case .appleSilicon:
47+
return "Apple Silicon"
48+
case .universal:
49+
return "Universal"
50+
}
51+
}
52+
53+
public var iconName: String {
54+
switch self {
55+
case .appleSilicon:
56+
return "m4.button.horizontal"
57+
case .universal:
58+
return "cpu.fill"
59+
}
60+
}
61+
}
62+
3863
extension Array where Element == Architecture {
3964
public var isAppleSilicon: Bool {
4065
self == [.arm64]
4166
}
67+
68+
public var isUniversal: Bool {
69+
self.contains([.arm64, .x86_64])
70+
}
4271
}

0 commit comments

Comments
 (0)